Background Color:
 
Background Pattern:
Reset
Search

Forum

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...Creating custom PDFs with C# by using multiple XML templatesCreating custom PDFs with C# by using multiple XML templates
Previous
 
Next
New Post
8/9/2016 10:02 AM
 

We stumbled upon Scryber the other day when we were looking for a solution for our project.

Our goal is to create a software that creates (multi page) PDFs with a header, body and footer.

Our idea is that we are having multiple XML files for the headers and bodys while there is one single footer XML. Depending on the software logic and choices, the right header and body will be picked from a folder, followed by adding the footer XML so the PDF can be generated.

Also, text placeholders should be available in the XML files for dynamic text content.

According to a video we found on youtube the files with the extension pdfx are getting parsed into PDF format. What we want to do is using C#.NET code to save the generated PDF into a folder on a server.

The questions now are:

a) Is it possible to tell our c# code to join the XML files header_123.xml, body_1447.xml and footer.xml together to create a PDF file?

b) Can we use placeholders?

c) Is there any API available on this website where we can look up all the methods we need?

 
New Post
8/9/2016 11:48 AM
 

Hi Dougy

The PDFX extension is a convenience to identify file types. The content is pure XML and can come from any source(s) - file, stream, result of an XSLT.

The Xml is parsed into an object graph or components which then render the final PDF output. References to other files can be made as components.

I see absolutely no reason why you cannot take the Xml and either transform it into the scryber schema, or bind the XML into components using the XmlDataSource (this would be a good start - http://www.scryber.co.uk/HowTo/tabid/133/Default.aspx?topic=Part+1.+Data+binding+and+XPath+selectors)

Once the object graph is created then you have full control of the hierarchy adding content, applying styles, what ever you need using C#. You could also look at the Items collection on the document to not hard code placeholders and values - http://www.scryber.co.uk/HowTo/tabid/133/Default.aspx?topic=Item+and+Query+String+Binding

After that it is simply a case of calling the ProcessDocument to generate the final PDF - http://www.scryber.co.uk/HowTo/tabid/133/Default.aspx?topic=Generation+Options

Download the package and give it a go - any problems, then just post :-)

 
New Post
8/10/2016 2:54 PM
 

Thank you so much, it seems that Scryber is the right product for our goal.

 
Previous
 
Next
HomeHomeScryberScryberDevelopment Que...Development Que...Creating custom PDFs with C# by using multiple XML templatesCreating custom PDFs with C# by using multiple XML templates