PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MultiPage Tiff file to PDF

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
Rajesh



Joined: 25 Oct 2007
Posts: 3

PostPosted: Thu Oct 25, 2007 9:10 am    Post subject: MultiPage Tiff file to PDF Reply with quote

Hi,

Can any one help me in creating pdf using pdfsharp for multipage tiff file. single page i was able to do. Please help me for mutipage tiff
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Thu Oct 25, 2007 10:36 am    Post subject: Reply with quote

You can specify which page you want if you load an Image from a TIFF file.
You use this Image like any other Image with PDFsharp.

The VS help file contains sample code on multi-page TIFF files.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
Rajesh



Joined: 25 Oct 2007
Posts: 3

PostPosted: Fri Oct 26, 2007 12:11 pm    Post subject: Reply with quote

Hi Thomas,

Can you please paste me the code for mutitiff as i was not able find to split the mutipage i can only get the count of no of pages available in multitiff file.

Where in PDF Sharp i can specifiy the image no.

currently i am using

PdfDocument outputDocument = new PdfDocument();
//
// // Open the document to import pages from it.
PdfDocument inputDocument = PdfReader.Open(outfilename, PdfDocumentOpenMode.Import);
string infilename = @"002.tif";
XImage image = XImage.FromFile(infilename);
// // Add new page to output document.
System.Drawing.Bitmap bm = new System.Drawing.Bitmap(@"001.tif");
total = bm.GetFrameCount(FrameDimension.Page);
for(Int32 k=0; k<total; k++)
{
//bm.SelectActiveFrame(FrameDimension.Page, k);
PdfPage page1= outputDocument.AddPage();
//
// Get Image width, Height and Resolution and Set output document Width and Height in Inches
page1.Width = XUnit.FromInch(image.Width/ image.HorizontalResolution);
page1.Height = XUnit.FromInch(image.Height/ image.VerticalResolution);
XGraphics gfx = XGraphics.FromPdfPage(page1, XGraphicsPdfPageOptions.Append);
gfx.DrawImage(image, 0, 0);
gfx.Dispose();
image.Dispose();
page1.Close();
}

Please Thomas if you can help me it would be great. i have 215 page tiff file to be converted to pdf. All the tiff files are of these many pages or more.

Thanks in Advance.

Regards,
Rajesh
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Mon Oct 29, 2007 9:46 am    Post subject: Reply with quote

Hi, Rajesh!

A small detail was missing in your code: you have to use the image you called SelectActiveFrame for.

Code:

      Bitmap bm = new Bitmap(infilename);
      int total = bm.GetFrameCount(FrameDimension.Page);
      for (Int32 k = 0; k < total; k++)
      {
        Bitmap bm2 = new Bitmap(infilename);
        bm2.SelectActiveFrame(FrameDimension.Page, k);
        XImage image = XImage.FromGdiPlusImage(bm2);
        PdfPage page1 = document.AddPage();
        //
        // Get Image width, Height and Resolution and Set output document Width and Height in Inches
        page1.Width = XUnit.FromInch(image.Width / image.HorizontalResolution);
        page1.Height = XUnit.FromInch(image.Height / image.VerticalResolution);
        gfx = XGraphics.FromPdfPage(page1, XGraphicsPdfPageOptions.Append);
        gfx.DrawImage(image, 0, 0);
        gfx.Dispose();
        image.Dispose();
        page1.Close();
        bm2.Dispose();
      }

_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
Rajesh



Joined: 25 Oct 2007
Posts: 3

PostPosted: Mon Oct 29, 2007 10:11 am    Post subject: Reply with quote

Hi Thomas,

Thanks a lot that worked for me. Great help,

Thanks,
Regards,
Rajesh
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com