Background Color:
Background Pattern:


Please Log In

We want you to contribute! 

This forum is a moderated environment. 
We try to keep it neat and tidy. In order to access the forum content we would like you to either or register.

HomeHomeScryberScryberDevelopment Que...Development Que...Appending documents together.Appending documents together.
New Post
7/28/2017 10:00 AM



I would like to append two documents together, I already have a working "personnelReport" template for the documents but would like to append a second "personnelReport" for a different person to the end of the document something like this:


var doc1 = PdfHelper.ParseMyDocument("PersonnelReport.pdfx");

doc1.Items["Personnel"] = Personnel[0];

var doc2 = PdfHelper.ParseMyDocument("PersonnelReport.pdfx");

doc2.Items["Personnel"] = Personnel[1];

var doc3 = doc1.Append(doc2); <--- something likethis

I would then be able to loop through my c# code to add multiple personnelReports to the same document without need to make a special template in pdfXml.



New Post
7/28/2017 10:51 AM

Hi Tim

If I get you correctly the easiest would be to separate the content out into a separate section file (ppfx) and then add that explicitly to a document.


<pdf:Section ....>

<!-- add the content you need -->



You can then load the file dynamically and add to your document in code (either parsed from a pdfx file or just in the code).

var doc = new PDFDocument();

var report = ParseSection(“PersonnelReport.ppfx”);

report.Items[“Personnel”] = Personnel[n];

var report = ParseSection(“PersonnelReport.ppfx”);
report.Items[“Personnel”] = Personnel[n+1];


You can then process and output in the normal way.




New Post
7/28/2017 11:43 AM

Thank you :)

New Post
7/31/2017 12:51 PM

Sorry but this just isn't working I have tried:


               foreach (var personnelDetailsItem in PersonnelList)

                    var section = PDFDocument.Parse("./Pdf/PersonnelReport.ppfx") as PDFSection;
                    section.Items["Personnel"] = personnelDetailsItem;
                    section.Items["PersonnelPhoto"] = PdfHelper.ParseImage(ImageHelper.ConvertImageSourceToBitMap(personnelDetailsItem.Photo), "person-placeholder-150x150.png");
                    section.Items["PersonnelEntreprise"] = PdfHelper.GetXPathNavigatorFromObject(personnelDetailsItem.EntrepriseList);


when i add two personnel to the list the item["personnel"] data is good, but the item[personnelPhoto] doesnt work: each section uses the same image from the first section.

furthermore the same happens for the items[PersonnelEntreprise], by the time i get to process document the "entrepriselist" data is the same for all sections of the document.

<?xml version="1.0" encoding="utf-8" ?>
<?scryber parser-mode='Strict' parser-log='false' append-log='false' log-level='Warnings' ?>
<pdf:Section  id="PersonnelReport"
              xmlns:pdf="Scryber.Components, Scryber.Components, Version=, Culture=neutral, PublicKeyToken=872cbeb81db952fe"
              xmlns:style="Scryber.Styles, Scryber.Styles, Version=, Culture=neutral, PublicKeyToken=872cbeb81db952fe"
              xmlns:data="Scryber.Data, Scryber.Components, Version=, Culture=neutral, PublicKeyToken=872cbeb81db952fe">


    <pdf:Div id="outerdiv"  >
      <pdf:Div style:x="10" style:y="10">
        <pdf:Image  img-data="{item:PersonnelPhoto}" style:class="myLogoImage" style:height="55" style:width="50" />
      <pdf:Div style:x="80" style:y="10">
        <pdf:Label style:class="myH1" text="{item:Personnel.Nom}"  />
        <pdf:Label style:class="myH1" text=" "  />
        <pdf:Label style:class="myH1" text="{item:Personnel.Prenom}" />
      <pdf:Div style:x="80" style:y="25">
        <data:XMLDataSource id="EntrepriseListSource" xpath-data="{item:PersonnelEntreprise}"/>
        <data:ForEach  datasource-id="EntrepriseListSource" select="/ArrayOfEntrepriseDetailsItem" count="1" start-index="0" >
            <data:ForEach select="EntrepriseDetailsItem" >
                <pdf:Label style:class="myH2" text="{xpath:Nom}"  />
                  <data:When test="PdfIsLast = 1" >
                      <pdf:Label style:class="myH2" text=""  />
                      <pdf:Label style:class="myH2" text=", "  />

    <pdf:Component-Ref source="StandardFooter.pcfx"/>



this is becoming very frustrating.

HomeHomeScryberScryberDevelopment Que...Development Que...Appending documents together.Appending documents together.