PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Jul 18, 2024 7:37 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: From Stream.value to
PostPosted: Fri Feb 10, 2012 11:42 am 
Offline

Joined: Fri Feb 10, 2012 11:31 am
Posts: 1
HI,

I am looking to extract text from my pdf.

Currently I do :

Code:
PdfDocument document = PdfReader.Open(this.filePath);
            foreach (PdfPage page in document.Pages)
            {
                for (int index = 0; index < page.Contents.Elements.Count; index++)
                {

                    PdfDictionary.PdfStream stream = page.Contents.Elements.GetDictionary(index).Stream;
                    String res = "";
                    foreach (byte cd in stream.Value)
                        res += (char)cd;
                   //TODO: res encoding invalid
            }


my variable res contains text but also text encoded.
I tried to use unicode, iso encoders without success.

Quote:
res contains:
BT
/R7 9.96 Tf
0.999386 0 0 1 278.4 761.6 Tm
( )Tj
-221.896 -12.12 Td
(\n \r  )Tj
227.54 -675.96 Td
( )Tj
ET


I am looking for something like (Hello World)Tj.

Maybe it's coded through the font ?

Could you give me some hints to decode the text.

Thx

Regards,
alex


Top
 Profile  
Reply with quote  
 Post subject: Re: From Stream.value to
PostPosted: Mon Feb 13, 2012 9:38 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Hi!

Not my area of expertise.

Maybe this thread will help:
viewtopic.php?p=4010#p4010

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 23 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