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

Creating 2 pdf files in one method
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1435
Page 1 of 1

Author:  Texxan [ Tue Nov 23, 2010 2:51 pm ]
Post subject:  Creating 2 pdf files in one method

Hi,

I have this problem when i try to create 2 pdf-documents in one method.

I first go like Document document = new MigraDoc.DocumentObjectModel.Document(); and create a "none-printer" version.

After that i try Document printdocument = new MigraDoc.DocumentObjectModel.Document(); to create a printer version with the same text-information,
but this second document get blank and adds the first one as new section so when i try to print it out i get 2 pages, one blank and one with the none-printer version.

Anyone know what can be wrong ?

Regards

Texxan

Author:  jeffhare [ Tue Nov 23, 2010 3:28 pm ]
Post subject:  Re: Creating 2 pdf files in one method

There's not quite enough info to go on here, but if you create 2 Documents, then set about populating both of them, make sure you x.Clone any objects you add to the second document.
You can't create an object (like a paragraph) and add it to both documents without cloning it.

Any chance this is the issue?
-Jeff

Author:  Texxan [ Wed Nov 24, 2010 8:00 am ]
Post subject:  Re: Creating 2 pdf files in one method

jeffhare wrote:
There's not quite enough info to go on here, but if you create 2 Documents, then set about populating both of them, make sure you x.Clone any objects you add to the second document.
You can't create an object (like a paragraph) and add it to both documents without cloning it.

Any chance this is the issue?
-Jeff


Hi Jeff!

Im not sure, but what I whant to do is to create an entire new docuemt. The first one has a background-image which the second one is not suppose to have.
I was thinking the "new MigraDoc.DocumentObjectModel.Document();" created an all new PDF-file, but thats may not be the case ?

Regards

Texxan

Author:  Texxan [ Wed Nov 24, 2010 8:23 am ]
Post subject:  Re: Creating 2 pdf files in one method

I found out was the problem was, i was useing the same PdfDocumentRenderer :) hehe, thx for the help anyway Jeff!


Regards

Texxan

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