PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jun 16, 2024 3:23 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Thu Mar 27, 2014 7:12 pm 
Offline

Joined: Mon Jan 06, 2014 6:54 pm
Posts: 5
Hi, Support:

I have a piece of C# code will merge two PDFs together.

there is nothing funcy, Open the first pdf in import mode, and insert each page into the second pdf. Eventually and save the pdf in a new pdf.

However, if my original pdf has some french characters, The new pdf can not display the french properly. Here is the code.

PdfDocument inputDocument1 = CompatiblePdfReader.Open(filename1, PdfDocumentOpenMode.Import); // first pdf to merge to second
PdfDocument inputDocument2 = CompatiblePdfReader.Open(filename2, PdfDocumentOpenMode.Modify); // second pdf to accept the merged pdf
PdfDocument origDocument2 = CompatiblePdfReader.Open(filename2, PdfDocumentOpenMode.InformationOnly); // final generated combined pdf

PdfDocument outputDocument = (PdfDocument)inputDocument2;

//the rest just read the first pdf page and insert it

foreach (PdfPage pageDoc1 in inputDocument1.Pages)
{
outputDocument.InsertPage(pageNo, pageDoc1);
}


however, the final document can not display french properly. see the attachment.


Attachments:
french.png
french.png [ 217.82 KiB | Viewed 8008 times ]
Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 29, 2014 6:49 am 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 341
Hi!
tangsabrina wrote:
The new pdf can not display the french properly.
I think the PDF files will be needed to replicate the problem.

PDFsharp was developed in Germany - and if German text works properly, French text also will. There is no general problem with French.

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 31, 2014 4:10 am 
Offline

Joined: Mon Jan 06, 2014 6:54 pm
Posts: 5
() => true wrote:
Hi!
tangsabrina wrote:
The new pdf can not display the french properly.
I think the PDF files will be needed to replicate the problem.

PDFsharp was developed in Germany - and if German text works properly, French text also will. There is no general problem with French.


Sorry, I am just newbie and does not really catch your idea.

Can you explain a bit more the PDF files willbe needed to replicate the problem? how can I do that? Merge PDFs using other software to test if it can display French or not? I used BIPubisher tool and merged two PDFs, the French works well.

Do I need any special Package for French Language?

Thanks,


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 31, 2014 6:08 am 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 341
tangsabrina wrote:
Can you explain a bit more the PDF files willbe needed to replicate the problem?
We cannot investigate this problem without PDF files and without sample code that allows us to reproduce the problem.

See also:
viewtopic.php?p=2094#p2094
(especially the section about SSCCE)

Are you sure the PDF files are displayed correctly before they are being merged?

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 31, 2014 1:30 pm 
Offline

Joined: Fri Apr 13, 2012 6:33 am
Posts: 10
It looks like your input documents contain UTF8 text, while your outputdocument tries to render this text in an 8-bit codepage like iso-latin1.

Danny


Top
 Profile  
Reply with quote  
PostPosted: Thu Apr 03, 2014 5:54 pm 
Offline

Joined: Mon Jan 06, 2014 6:54 pm
Posts: 5
() => true wrote:
tangsabrina wrote:
Can you explain a bit more the PDF files willbe needed to replicate the problem?
We cannot investigate this problem without PDF files and without sample code that allows us to reproduce the problem.

See also:
viewtopic.php?p=2094#p2094
(especially the section about SSCCE)

Are you sure the PDF files are displayed correctly before they are being merged?


Yes, the original PDF files are displayed correctly.

I had tried attached the two pdfs and the code. but the size is quite big and do not allow me to attach them. how can I give them to you?

SEE THE PAGE 12 IN THE PDF,

the code is quite large. I do not think you need to understand the logic quite a lot.

Thanks very much.


Top
 Profile  
Reply with quote  
PostPosted: Thu Apr 03, 2014 5:55 pm 
Offline

Joined: Mon Jan 06, 2014 6:54 pm
Posts: 5
dheijl wrote:
It looks like your input documents contain UTF8 text, while your outputdocument tries to render this text in an 8-bit codepage like iso-latin1.

Danny



then, what should I do to fix this? Is there any place I can set up the encoding method?

Thanks.


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 07, 2014 9:17 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3100
Location: Cologne, Germany
tangsabrina wrote:
SEE THE PAGE 12 IN THE PDF
Which PDF?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 138 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group