PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Jul 05, 2024 11:22 pm

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
PostPosted: Sat Sep 04, 2010 11:41 am 
Offline

Joined: Fri Aug 20, 2010 12:31 pm
Posts: 3
Hi All,
i have a problem with creating pdf document.
My requirement is in my project i am scanning documents and saving them as tiff images.i need to add those scanned tiff images to a pdf file.
for ex:if i have scanned 3 images then those 3 images should be added to some sample.pdf file....

Please help me to solve this....


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 24, 2011 1:32 pm 
Offline

Joined: Mon Jan 24, 2011 1:24 pm
Posts: 3
This may be a bit (more than a bit, actually) late, but it might still be using for someone opening this topic after a search.

Here's how I do it: one-by-one.
Code:
            PdfSharp.Pdf.PdfDocument document = new PdfSharp.Pdf.PdfDocument();
           
            foreach(string s in System.IO.Directory.GetFiles(SourceFolder, "*.tif"))
            {
                PdfSharp.Pdf.PdfPage page = new PdfSharp.Pdf.PdfPage();
                page.Size = PdfSharp.PageSize.A4;
                PdfSharp.Drawing.XGraphics xGr = PdfSharp.Drawing.XGraphics.FromPdfPage(document.Pages.Add(page));
                PdfSharp.Drawing.XImage img = PdfSharp.Drawing.XImage.FromFile(s);
                xGr.DrawImage(img, 0, 0);
            }
           
            document.Save(TargetName);
            document.Close();


hth,
peter


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: Bing [Bot], Google [Bot] and 59 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