Add insert_pdf(xpath, href)
Starou opened this issue · 0 comments
Starou commented
- Ajouter l'attribut XML
href
avec le path du document PDF dans le XMLElement de la Story. - Ajouter le
<PDF>
dans leSpread
- Calculer et assigner l'attribut
ItemTransform
-
Calculer et assigner la balisePas l'air utile: tester de virer (hardcoded)<GraphicBounds>
- Calculer et assigner l'attribut
Spread
With u125
being the XMLContent
attribute value of the Story/BackingStory XMLElement
.
Before inserting :
<Rectangle Self="u125" ContentType="GraphicType" StoryTitle="$ID/" GradientFillStart="0 0" GradientFillLength="0" GradientFillAngle="0" GradientStrokeStart="0 0" GradientStrokeLength="0" GradientStrokeAngle="0" ItemLayer="ub3" Locked="false" LocalDisplaySetting="Default" GradientFillHiliteLength="0" GradientFillHiliteAngle="0" GradientStrokeHiliteLength="0" GradientStrokeHiliteAngle="0" AppliedObjectStyle="ObjectStyle/$ID/[None]" Visible="true" Name="$ID/" ItemTransform="1 0 0 1 -0.7086614173227589 6.614173228346431">
<Properties>
<PathGeometry>
<GeometryPathType PathOpen="false">
<PathPointArray>
<PathPointType Anchor="28.818897637795256 -343.93700787401576" LeftDirection="28.818897637795256 -343.93700787401576" RightDirection="28.818897637795256 -343.93700787401576"/>
<PathPointType Anchor="28.818897637795256 334.9606299220236" LeftDirection="28.818897637795256 334.9606299220236" RightDirection="28.818897637795256 334.9606299220236"/>
<PathPointType Anchor="624.3307086614174 334.9606299220236" LeftDirection="624.3307086614174 334.9606299220236" RightDirection="624.3307086614174 334.9606299220236"/>
<PathPointType Anchor="624.3307086614174 -343.93700787401576" LeftDirection="624.3307086614174 -343.93700787401576" RightDirection="624.3307086614174 -343.93700787401576"/>
</PathPointArray>
</GeometryPathType>
</PathGeometry>
</Properties>
<TextWrapPreference Inverse="false" ApplyToMasterPageOnly="false" TextWrapSide="BothSides" TextWrapMode="None">
<Properties>
<TextWrapOffset Top="0" Left="0" Bottom="0" Right="0"/>
</Properties>
</TextWrapPreference>
<InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false"/>
<FrameFittingOption LeftCrop="28.818897637795256" TopCrop="-343.93700787401576" RightCrop="-623.3307086614174" BottomCrop="-333.9606299220236"/>
<ObjectExportOption AltTextSourceType="SourceXMLStructure" ActualTextSourceType="SourceXMLStructure" CustomAltText="$ID/" CustomActualText="$ID/" ApplyTagType="TagFromStructure" CustomImageConversion="false" ImageConversionType="JPEG" CustomImageSizeOption="SizeRelativeToPageWidth" ImageExportResolution="Ppi300" GIFOptionsPalette="AdaptivePalette" GIFOptionsInterlaced="true" JPEGOptionsQuality="High" JPEGOptionsFormat="BaselineEncoding" CustomImageAlignment="false" ImageAlignment="AlignLeft" ImageSpaceBefore="0" ImageSpaceAfter="0" SpaceUnit="CssEm" UseImagePageBreak="false" ImagePageBreak="PageBreakBefore">
<Properties>
<AltMetadataProperty NamespacePrefix="$ID/" PropertyPath="$ID/"/>
<ActualMetadataProperty NamespacePrefix="$ID/" PropertyPath="$ID/"/>
</Properties>
</ObjectExportOption>
</Rectangle>
And after manually inserting a PDF, a new attribute in the Story (u125
is now u15c
):
<XMLElement Self="di3i4i6i7" MarkupTag="XMLTag/module" XMLContent="u15c">
<XMLAttribute Self="di3i4i6i7XMLAttributenhref" Name="href" Value="file:///Users/sguerra/Downloads/001_print.pdf" />
</XMLElement>
And in the Spread, the corresponding element is now a <PDF>
in the initial <Rectangle>
:
<Rectangle Self="u12b" ContentType="GraphicType" StoryTitle="$ID/" ParentInterfaceChangeCount="" TargetInterfaceChangeCount="" LastUpdatedInterfaceChangeCount="" OverriddenPageItemProps="" HorizontalLayoutConstraints="FlexibleDimension FixedDimension FlexibleDimension" VerticalLayoutConstraints="FlexibleDimension FixedDimension FlexibleDimension" GradientFillStart="0 0" GradientFillLength="0" GradientFillAngle="0" GradientStrokeStart="0 0" GradientStrokeLength="0" GradientStrokeAngle="0" ItemLayer="ub2" Locked="false" LocalDisplaySetting="Default" GradientFillHiliteLength="0" GradientFillHiliteAngle="0" GradientStrokeHiliteLength="0" GradientStrokeHiliteAngle="0" AppliedObjectStyle="ObjectStyle/$ID/[None]" Visible="true" Name="$ID/" ItemTransform="1 0 0 1 -0.7086614173227589 6.614173228346431">
<Properties>
<PathGeometry>
<GeometryPathType PathOpen="false">
<PathPointArray>
<PathPointType Anchor="28.818897637795256 -343.93700787401576" LeftDirection="28.818897637795256 -343.93700787401576" RightDirection="28.818897637795256 -343.93700787401576" />
<PathPointType Anchor="28.818897637795256 334.9606299220236" LeftDirection="28.818897637795256 334.9606299220236" RightDirection="28.818897637795256 334.9606299220236" />
<PathPointType Anchor="624.3307086614174 334.9606299220236" LeftDirection="624.3307086614174 334.9606299220236" RightDirection="624.3307086614174 334.9606299220236" />
<PathPointType Anchor="624.3307086614174 -343.93700787401576" LeftDirection="624.3307086614174 -343.93700787401576" RightDirection="624.3307086614174 -343.93700787401576" />
</PathPointArray>
</GeometryPathType>
</PathGeometry>
</Properties>
<TextWrapPreference Inverse="false" ApplyToMasterPageOnly="false" TextWrapSide="BothSides" TextWrapMode="None">
<Properties>
<TextWrapOffset Top="0" Left="0" Bottom="0" Right="0" />
</Properties>
<ContourOption ContourType="SameAsClipping" IncludeInsideEdges="false" ContourPathName="$ID/" />
</TextWrapPreference>
<InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false" />
<FrameFittingOption RightCrop="-7.274292713075283" BottomCrop="-8.329675149554987" />
<ObjectExportOption EpubType="$ID/" UseExistingImage="false" CustomHeightType="DefaultHeight" CustomHeight="$ID/" CustomWidthType="DefaultWidth" CustomWidth="$ID/" AltTextSourceType="SourceXMLStructure" ActualTextSourceType="SourceXMLStructure" CustomAltText="$ID/" CustomActualText="$ID/" ApplyTagType="TagFromStructure" CustomImageConversion="false" ImageConversionType="JPEG" ImageExportResolution="Ppi300" GIFOptionsPalette="AdaptivePalette" GIFOptionsInterlaced="true" JPEGOptionsQuality="High" JPEGOptionsFormat="BaselineEncoding" ImageAlignment="AlignLeft" ImageSpaceBefore="0" ImageSpaceAfter="0" UseImagePageBreak="false" ImagePageBreak="PageBreakBefore" CustomImageAlignment="false" SpaceUnit="CssPixel" CustomLayout="false" CustomLayoutType="AlignmentAndSpacing" UseOriginalImage="false">
<Properties>
<AltMetadataProperty NamespacePrefix="$ID/" PropertyPath="$ID/" />
<ActualMetadataProperty NamespacePrefix="$ID/" PropertyPath="$ID/" />
</Properties>
</ObjectExportOption>
<PDF Self="u15c" GrayVectorPolicy="IgnoreAll" RGBVectorPolicy="IgnoreAll" CMYKVectorPolicy="IgnoreAll" OverriddenPageItemProps="" LocalDisplaySetting="Default" ImageTypeName="$ID/Adobe Portable Document Format (PDF)" AppliedObjectStyle="ObjectStyle/$ID/[None]" ItemTransform="1 0 0 1 -9.418071356345365 -472.7240256962814" ParentInterfaceChangeCount="" TargetInterfaceChangeCount="" LastUpdatedInterfaceChangeCount="" HorizontalLayoutConstraints="FlexibleDimension FixedDimension FlexibleDimension" VerticalLayoutConstraints="FlexibleDimension FixedDimension FlexibleDimension" Visible="true" Name="$ID/">
<Properties>
<GraphicBounds Left="38.236968994140625" Top="128.78701782226562" Right="626.4744873046875" Bottom="799.35498046875" />
</Properties>
<TextWrapPreference Inverse="false" ApplyToMasterPageOnly="false" TextWrapSide="BothSides" TextWrapMode="None">
<Properties>
<TextWrapOffset Top="0" Left="0" Bottom="0" Right="0" />
</Properties>
<ContourOption ContourType="SameAsClipping" IncludeInsideEdges="false" ContourPathName="$ID/" />
</TextWrapPreference>
<PDFAttribute PageNumber="1" PDFCrop="CropContentVisibleLayers" TransparentBackground="true" />
<MetadataPacketPreference>
<Properties>
<Contents><![CDATA[<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c011 79.156289, 2014/03/31-23:39:12 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
<xmp:CreateDate>2017-10-05T17:30:17+02:00</xmp:CreateDate>
<xmp:MetadataDate>2017-10-05T17:30:17+02:00</xmp:MetadataDate>
<xmp:ModifyDate>2017-10-05T17:30:17+02:00</xmp:ModifyDate>
<xmp:CreatorTool>Adobe InDesign CC 2014 (Macintosh)</xmp:CreatorTool>
<xmpMM:InstanceID>uuid:b51766f2-f97c-d84b-9e18-61d888b23c43</xmpMM:InstanceID>
<xmpMM:OriginalDocumentID>xmp.did:F77F117407206811994CC08BC446421B</xmpMM:OriginalDocumentID>
<xmpMM:DocumentID>xmp.id:cbf0e694-f86f-4b8d-8d95-d88d67def222</xmpMM:DocumentID>
<xmpMM:RenditionClass>proof:pdf</xmpMM:RenditionClass>
<xmpMM:History>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<stEvt:action>converted</stEvt:action>
<stEvt:parameters>from application/x-indesign to application/pdf</stEvt:parameters>
<stEvt:softwareAgent>Adobe InDesign CC 2014 (Macintosh)</stEvt:softwareAgent>
<stEvt:changed>/</stEvt:changed>
<stEvt:when>2017-10-05T17:30:17+02:00</stEvt:when>
</rdf:li>
</rdf:Seq>
</xmpMM:History>
<xmpMM:DerivedFrom rdf:parseType="Resource">
<stRef:instanceID>xmp.iid:fababbe5-78c7-431b-9f4d-dc087dcbebeb</stRef:instanceID>
<stRef:documentID>xmp.did:06801174072068118C14CD5941777246</stRef:documentID>
<stRef:originalDocumentID>xmp.did:F77F117407206811994CC08BC446421B</stRef:originalDocumentID>
<stRef:renditionClass>default</stRef:renditionClass>
</xmpMM:DerivedFrom>
<dc:format>application/pdf</dc:format>
<pdf:Producer>Adobe PDF Library 11.0</pdf:Producer>
<pdf:Trapped>False</pdf:Trapped>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="r"?>]]></Contents>
</Properties>
</MetadataPacketPreference>
<Link Self="u160" AssetURL="$ID/" AssetID="$ID/" LinkResourceURI="file:/Users/sguerra/Downloads/001_print.pdf" LinkResourceFormat="$ID/Adobe Portable Document Format (PDF)" StoredState="Normal" LinkClassID="35906" LinkClientID="257" LinkResourceModified="false" LinkObjectModified="false" ShowInUI="true" CanEmbed="true" CanUnembed="true" CanPackage="true" ImportPolicy="NoAutoImport" ExportPolicy="NoAutoExport" LinkImportStamp="file 131516910170000000 244568" LinkImportModificationTime="2017-10-05T17:30:17" LinkImportTime="2017-10-06T12:46:46" LinkResourceSize="0~3bb58" />
<ClippingPathSettings ClippingType="None" InvertPath="false" IncludeInsideEdges="false" RestrictToFrame="false" UseHighResolutionImage="true" Threshold="25" Tolerance="2" InsetFrame="0" AppliedPathName="$ID/" Index="-1" />
<GraphicLayerOption UpdateLinkOption="KeepOverrides" />
</PDF>
</Rectangle>