Quantcast

Big pdf pagesize cause problems

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Big pdf pagesize cause problems

Baskes
Hi,

I have created a pdf with the code below.

Based on a image i select the page size is automatically choose to fit.

The problem i have is i have a image which is very big.  The image size is 16535 * 5905.
When i add the image the pdf is generated without errors, the pdf size is large (the image = +- 10mb) the pdf generated also.

But when i open the pdf with adobe acrobat reader 8 i only see a white page.

When i create the pdf with a image which is smaller in size (7618 * 5846) it works perfectly? Also when i make the page size smaller and load the big image in that pdf the image is shown (but it doesnt fit on the page).

What can i do to solve this problem. I use itextsharp version 4.1.2



Dim PdfName As String = PhoneNumber + Guid.NewGuid.ToString + ".pdf"

            Dim fdoj As String = Server.MapPath("images/" + selecteditem.Value)
            Dim BackImage As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(Server.MapPath("images/" + selecteditem.Value))



            Dim pageSize As New iTextSharp.text.Rectangle(BackImage.Width, BackImage.Height)
            ' .pageSize = New iTextSharp.text.Rectangle(16535, 5905)   --> big image size!
            Dim doc As Document = New Document(pageSize)


            Dim writer As PdfWriter = PdfWriter.GetInstance(doc, New FileStream(Server.MapPath("GeneratedPDF") + "\" + PdfName, FileMode.CreateNew))
    

            doc.Open()

           
            Dim ContentPDF As PdfContentByte = writer.DirectContent

            BackImage.SetAbsolutePosition(0, 0)
            ContentPDF.AddImage(BackImage)
          

            doc.Close()


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
itextsharp-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Big pdf pagesize cause problems

Erik Pfingsten

Well, if my math is correct, 16535 divided by 72 points per inch means you are creating a page that is 229 inches wide, correct?  The maximum with iText is 200 inches (or 14,1400 points)

 

Erik Pfingsten

From: Baskes [mailto:[hidden email]]
Sent: Tuesday, May 12, 2009 10:05 AM
To: [hidden email]
Subject: [itextsharp-questions] Big pdf pagesize cause problems

 

Hi,

I have created a pdf with the code below.

Based on a image i select the page size is automatically choose to fit.

The problem i have is i have a image which is very big.  The image size is 16535 * 5905.
When i add the image the pdf is generated without errors, the pdf size is large (the image = +- 10mb) the pdf generated also.

But when i open the pdf with adobe acrobat reader 8 i only see a white page.

When i create the pdf with a image which is smaller in size (7618 * 5846) it works perfectly? Also when i make the page size smaller and load the big image in that pdf the image is shown (but it doesnt fit on the page).

What can i do to solve this problem. I use itextsharp version 4.1.2



Dim PdfName As String = PhoneNumber + Guid.NewGuid.ToString + ".pdf"

            Dim fdoj As String = Server.MapPath("images/" + selecteditem.Value)
            Dim BackImage As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(Server.MapPath("images/" + selecteditem.Value))



            Dim pageSize As New iTextSharp.text.Rectangle(BackImage.Width, BackImage.Height)
            ' .pageSize = New iTextSharp.text.Rectangle(16535, 5905)   --> big image size!
            Dim doc As Document = New Document(pageSize)


            Dim writer As PdfWriter = PdfWriter.GetInstance(doc, New FileStream(Server.MapPath("GeneratedPDF") + "\" + PdfName, FileMode.CreateNew))
    

            doc.Open()

           
            Dim ContentPDF As PdfContentByte = writer.DirectContent

            BackImage.SetAbsolutePosition(0, 0)
            ContentPDF.AddImage(BackImage)
          

            doc.Close()


This message, including any attachments, may contain information
which is confidential and privileged. Unless you are the addressee (or 
authorized to receive for the addressee), you may not read, use, copy 
or disclose to anyone the message, its attachments, or any information 
contained therein. If you have received the message in error, please 
advise the sender by reply e-mail and delete the message and any 
attachments.

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
itextsharp-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Big pdf pagesize cause problems

Baskes
You are right. Thanks for the quick reply. Pdf version 1.4 is limited to this size.

I will look for a other pdf generator then.

Thanks.

Bas

2009/5/12 Erik Pfingsten <EPfingsten@.com>

Well, if my math is correct, 16535 divided by 72 points per inch means you are creating a page that is 229 inches wide, correct?  The maximum with iText is 200 inches (or 14,1400 points)

 

Erik Pfingsten




------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
itextsharp-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Big pdf pagesize cause problems

Paulo Soares-3
The restriction is not in iTextSharp but rather on the pdf format itself. From pdf 1.7 implementation Notes:

In PDF versions earlier than PDF 1.6, the size of the default user space unit is fixed at 1 ⁄ 72 inch. In Acrobat viewers earlier than version 4.0, the minimum allowed page size is 72 by 72 units in default user space (1 by 1 inch); the maximum is 3240 by 3240 units (45 by 45 inches). In Acrobat versions 5.0 and later, the minimum allowed page size is 3 by 3 units (approximately 0.04 by 0.04 inch); the maximum is 14,400 by 14,400 units (200 by 200 inches).
Beginning with PDF 1.6, the size of the default user space unit may be set with the UserUnit entry of the page dictionary. Acrobat 7.0 supports a maximum UserUnit value of 75,000, which gives a maximum page dimension of 15,000,000 inches (14,400 * 75,000 * 1 ⁄ 72). The minimum UserUnit value is 1.0 (the default).


You can change the page user units in iTextSharp with PdfWriter.Userunit. You'll need Acrobat 7 for this to work.

Paulo

> -----Original Message-----
> From: Baskes [mailto:[hidden email]]
> Sent: Tuesday, May 12, 2009 3:49 PM
> To: Post all your questions about iTextSharp here
> Subject: [itextsharp-questions] Big pdf pagesize cause problems
>
> You are right. Thanks for the quick reply. Pdf version 1.4 is
> limited to this size.
>
> I will look for a other pdf generator then.
>
> Thanks.
>
> Bas
>
>
> 2009/5/12 Erik Pfingsten <EPfingsten@.com>
>
>
> Well, if my math is correct, 16535 divided by 72 points
> per inch means you are creating a page that is 229 inches
> wide, correct?  The maximum with iText is 200 inches (or
> 14,1400 points)
>
>
>
> Erik Pfingsten
>
>
>
>
>
>

Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
itextsharp-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions
Loading...