PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

How create a PDF template with PdfSharp
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3779
Page 1 of 1

Author:  olibara [ Sun Apr 29, 2018 10:09 am ]
Post subject:  How create a PDF template with PdfSharp

Hello
Since I use PdfSharp with cSharp, I usually create document from scratch, positioning text and image with relative of absolute xRect
Straight and easy

But in some case it can be more relevant to Open a previously created PDF Template and just fill in a few variable elements (Name, Adress etc)

Is it possible to create such Template with PdfSharp ?
I guess it should be a way to specify variable fields ans save a PDF as a template
Then import the template with a PdfReader and fill the fields

Unfortunately I was not able to find clear and effective explanation about this ?
Is it possible ?
Is it the way it would works ?

Thanks for any help

Author:  TH-Soft [ Sun Apr 29, 2018 12:04 pm ]
Post subject:  Re: How create a PDF template with PdfSharp

Hi!
olibara wrote:
Unfortunately I was not able to find clear and effective explanation about this?
There are many ways.
One approach:
http://pdfsharp.net/wiki/XForms-sample.ashx

Author:  olibara [ Sun Apr 29, 2018 7:40 pm ]
Post subject:  Re: How create a PDF template with PdfSharp

Thank you TH-Soft

I had seen this example but as it is mentioned it "Draw the XPdfForm on your PDF page like an image:"

This is far from an efficient way to use a Template
Also this is not really a template at all : this is only a graphic component ready to be drawn as an image !

What I was more looking for, it is a way to anchor a few variable in a PDF document (name, address, Date etc..) and save-it as a template
Then Import that template replace the variable by the current value and save the result as final document !

Is it first possible ? .. and is there some easy way to do it ?

If not, I can of course continue to create the whole final document from scratch but this is less flexible and requires an update of the application for any lay-out changes

Author:  TH-Soft [ Mon Apr 30, 2018 6:33 am ]
Post subject:  Re: How create a PDF template with PdfSharp

olibara wrote:
This is far from an efficient way to use a Template
There is little overhead in the PDF file, so with respect to that this method is efficient.

olibara wrote:
If not, I can of course continue to create the whole final document from scratch but this is less flexible and requires an update of the application for any lay-out changes
We use a generic application and customer-specific DLLs that handle the layout. Those DLLs include PDF files with pre-made pages for cover and some content pages, but also page backgrounds.
We do not have to change the application if the layout changes for one customer. But we still have to compile a DLL for them.

If you think that AcroForms are templates as you want them, then feel free to try them. Older versions of PDFsharp included an AcroForms sample.

Author:  olibara [ Mon Apr 30, 2018 6:34 pm ]
Post subject:  Re: How create a PDF template with PdfSharp

Thank you TH-Soft
Indeed DLL can be an alternative

The best would be anyway what I think Acroform is : Having a PDF document template with Anchored variables, Open and fill fariables with Values ...
But Have no Idea how to really use it ?

- Is my understanding correct ?
- Is it still supported ?
- Do you have some link where I can found explanation about a:Create a template with variable fields, b:Fill the template with values

Thanks a lot for your Help

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/