Quantcast

Convert PDF to an Image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Convert PDF to an Image

Eli Segev
Convert PDF to an Image

Is there any way to put a PDF page (PdfIndirectPage, or PdfPage) into a PdfPCell?  I thought there would be some way of making a page into an Image, but I can't figure this out.  This is essentially like converting a PDF page into an Image.  Any suggestions?

------------

Eli Segev



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

Manoj -2
Convert PDF to an Image
You are required to do following code:
 
Image image = Image.getInstance("abc.gif");
document.add(image);
 
Make sure your document is open prior to adding.
 
 
----- Original Message -----
Sent: Monday, July 10, 2006 7:57 PM
Subject: [iText-questions] Convert PDF to an Image

Is there any way to put a PDF page (PdfIndirectPage, or PdfPage) into a PdfPCell?  I thought there would be some way of making a page into an Image, but I can't figure this out.  This is essentially like converting a PDF page into an Image.  Any suggestions?

------------

Eli Segev



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

Eli Segev
Convert PDF to an Image

My question was not about images, but about PDF pages. 

------------
Eli Segev
781-370-6096

 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Manoj
Sent: Monday, July 10, 2006 11:18 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Convert PDF to an Image

 

You are required to do following code:

 

Image image = Image.getInstance("abc.gif");

document.add(image);

 

Make sure your document is open prior to adding.

 

 

----- Original Message -----

Sent: Monday, July 10, 2006 7:57 PM

Subject: [iText-questions] Convert PDF to an Image

 

Is there any way to put a PDF page (PdfIndirectPage, or PdfPage) into a PdfPCell?  I thought there would be some way of making a page into an Image, but I can't figure this out.  This is essentially like converting a PDF page into an Image.  Any suggestions?

------------

Eli Segev



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

Manoj -2

http://itextdocs.lowagie.com/tutorial/


On 10/07/06, Segev, Eli <[hidden email]> wrote:

My question was not about images, but about PDF pages. 

------------
Eli Segev
781-370-6096

 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Manoj
Sent: Monday, July 10, 2006 11:18 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Convert PDF to an Image

 

You are required to do following code:

 

Image image = Image.getInstance("abc.gif");

document.add(image);

 

Make sure your document is open prior to adding.

 

 

----- Original Message -----

Sent: Monday, July 10, 2006 7:57 PM

Subject: [iText-questions] Convert PDF to an Image

 

Is there any way to put a PDF page (PdfIndirectPage, or PdfPage) into a PdfPCell?  I thought there would be some way of making a page into an Image, but I can't figure this out.  This is essentially like converting a PDF page into an Image.  Any suggestions?

------------

Eli Segev



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
<a href="http://sel.as-us.falkag.net/sel?cmd=lnk&amp;kid=120709&amp;bid=263057&amp;dat=121642" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


_______________________________________________
iText-questions mailing list
[hidden email]
<a href="https://lists.sourceforge.net/lists/listinfo/itext-questions" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://sel.as-us.falkag.net/sel?cmd=lnk&amp;kid=120709&amp;bid=263057&amp;dat=121642" target="_blank"> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


_______________________________________________
iText-questions mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.sourceforge.net/lists/listinfo/itext-questions" target="_blank">https://lists.sourceforge.net/lists/listinfo/itext-questions





--
Regards,
Manoj


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

Paulo Soares
In reply to this post by Eli Segev
Image.getInstance(PdfWriter.getImportedPage(PdfReader reader, int
pageNumber))

Paulo

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On
> Behalf Of Segev, Eli
> Sent: Monday, July 10, 2006 3:28 PM
> To: [hidden email]
> Subject: [iText-questions] Convert PDF to an Image
>
> Is there any way to put a PDF page (PdfIndirectPage, or
> PdfPage) into a PdfPCell?  I thought there would be some way
> of making a page into an Image, but I can't figure this out.  
> This is essentially like converting a PDF page into an Image.
>  Any suggestions?
>
> ------------
>
> Eli Segev
>
>

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.




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

Eli Segev
I am trying the following code:

PdfReader pdfReader = new PdfReader(fileName);
FileOutputStream output = new FileOutputStream(outputFile);
PdfStamper pdfStamper = new PdfStamper(pdfReader, output);
Image jpeg = Jpeg.getInstance(pdfStamper.getImportedPage(pdfReader, 1));

Is it possible to get the contents of the image into a byte array?  I
have noticed that jpeg.getOriginalData() returns null.

------------
Eli Segev



-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of
Paulo Soares
Sent: Monday, July 10, 2006 11:33 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Convert PDF to an Image

Image.getInstance(PdfWriter.getImportedPage(PdfReader reader, int
pageNumber))

Paulo




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

Mark Storer-3
In reply to this post by Eli Segev
> Image jpeg = Jpeg.getInstance(pdfStamper.getImportedPage(pdfReader, 1));

There is no Jpeg.getInstance.  While it compiles, it's really just calling Image.getInstance().  Kinda misleading.  Further, an Image isn't necessarily a bunch of pixels.  If you call jpeg.isJpeg(), it'll return false, while jpeg.isImgTemplate() == true.  Even if getOriginalData() returned something, the "original data" in this case is the drawing commands from the PdfTemplate, not JPEG data.

For this to work, iText would have to know how to render a PDF.  It does not:

http://www.lowagie.com/iText/faq.html#pdfviewer

--Mark Storer
  Senior Software Engineer
  Cardiff Software

#include <disclaimer>
typedef std::Disclaimer<Cardiff> DisCard;



> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]On Behalf Of
> Segev, Eli
> Sent: Friday, September 08, 2006 8:00 AM
> To: Post all your questions about iText here
> Subject: Re: [iText-questions] Convert PDF to an Image
>
>
> I am trying the following code:
>
> PdfReader pdfReader = new PdfReader(fileName);
> FileOutputStream output = new FileOutputStream(outputFile);
> PdfStamper pdfStamper = new PdfStamper(pdfReader, output);

>
> Is it possible to get the contents of the image into a byte array?  I
> have noticed that jpeg.getOriginalData() returns null.
>
> ------------
> Eli Segev
>
>
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Paulo Soares
> Sent: Monday, July 10, 2006 11:33 AM
> To: Post all your questions about iText here
> Subject: Re: [iText-questions] Convert PDF to an Image
>
> Image.getInstance(PdfWriter.getImportedPage(PdfReader reader, int
> pageNumber))
>
> Paulo
>
>
>
>
> --------------------------------------------------------------
> -----------
> Using Tomcat but need to do more? Need to support web
> services, security?
> Get stuff done quickly with pre-integrated technology to make
> your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on
> Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&
dat=121642
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Convert PDF to an Image

Eli Segev
In reply to this post by Eli Segev
Convert PDF to an Image

I am trying the following code:

PdfReader pdfReader = new PdfReader(fileName);

FileOutputStream output = new FileOutputStream(outputFile);

PdfStamper pdfStamper = new PdfStamper(pdfReader, output);

Image jpeg = Jpeg.getInstance(pdfStamper.getImportedPage(pdfReader, 1));

Is it possible to get the contents of the image into a byte array?  I have noticed that jpeg.getOriginalData() returns null.  Why?

------------

Eli Segev


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

Bill Ensley
Convert PDF to an Image
This question was previously answered for you.
 
No, what you are doing will not work, it is a com.lowagie.text.Image instance that you are creating,
NOT a java.awt.image.
 
It is only usable with the iText library.
 
-Bill Ensley
Bear Printing


From: [hidden email] [mailto:[hidden email]] On Behalf Of Segev, Eli
Sent: Monday, September 11, 2006 11:25 AM
To: [hidden email]
Subject: [iText-questions] Convert PDF to an Image

I am trying the following code:

PdfReader pdfReader = new PdfReader(fileName);

FileOutputStream output = new FileOutputStream(outputFile);

PdfStamper pdfStamper = new PdfStamper(pdfReader, output);

Image jpeg = Jpeg.getInstance(pdfStamper.getImportedPage(pdfReader, 1));

Is it possible to get the contents of the image into a byte array?  I have noticed that jpeg.getOriginalData() returns null.  Why?

------------

Eli Segev


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

Eli Segev
Convert PDF to an Image

Bill,

 

I have not seen my question posted and answered before.  On what date was it answered?

 

I did not understand your answer as to why I get a null byte array.

 

------------
Eli Segev
 

 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Bill Ensley
Sent:
Monday, September 11, 2006 5:32 PM
To: 'Post all your questions about iText here'
Subject: Re: [iText-questions] Convert PDF to an Image

 

This question was previously answered for you.

 

No, what you are doing will not work, it is a com.lowagie.text.Image instance that you are creating,

NOT a java.awt.image.

 

It is only usable with the iText library.

 

-Bill Ensley

Bear Printing

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Segev, Eli
Sent:
Monday, September 11, 2006 11:25 AM
To: [hidden email]
Subject: [iText-questions] Convert PDF to an Image

I am trying the following code:

PdfReader pdfReader = new PdfReader(fileName);

FileOutputStream output = new FileOutputStream(outputFile);

PdfStamper pdfStamper = new PdfStamper(pdfReader, output);

Image jpeg = Jpeg.getInstance(pdfStamper.getImportedPage(pdfReader, 1));

Is it possible to get the contents of the image into a byte array?  I have noticed that jpeg.getOriginalData() returns null.  Why?

------------

Eli Segev


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

blowagie
Segev, Eli wrote:

> Bill,
>
>  
>
> I have not seen my question posted and answered before.  On what date
> was it answered?
>
On numerous occasions people have asked if it is possible to use iText
to convert PDF to an Image file.
http://www.nabble.com/Save-a-page-as-jpeg-tf1888375.html#a5162983
http://www.nabble.com/PDF--%3E-Tiff-conversion-possible--tf1705167.html#a4628693
http://www.nabble.com/PDF-to-Image-tf534921.html#a1475860
...
You have been working for a long time with iText now,
I was very surprised to see the code sample you sent.
best regards,
Bruno

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Mesh in SVG to PDF

Eli Segev
Hi,

This is a small SVG file that contains a gray mesh pattern:

<?xml version="1.0" encoding="utf-8"?>
        <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
        <svg x="0" y="0" width="50" height="40">
                <defs>
                        <pattern id="MASTERPATTERN_0_" width="3.452"
height="3.597" patternUnits="userSpaceOnUse" viewBox="0.001 0.000 3.452
3.597">
                                <path style="fill:none;stroke:none;" d="
M0.00,0.00 C0.00,0.00 3.45,0.00 3.45,0.00 C3.45,0.00 3.45,3.60 3.45,3.60
C3.45,3.60 0.00,3.60 0.00,3.60 C0.00,3.60 0.00,0.00 0.00,0.00"/>
                                <path style="fill:none;stroke:none;" d="
M0.00,0.00 C0.00,0.00 3.45,0.00 3.45,0.00 C3.45,0.00 3.45,3.60 3.45,3.60
C3.45,3.60 0.00,3.60 0.00,3.60 C0.00,3.60 0.00,0.00 0.00,0.00"/>
                                <path
style="fill:none;stroke:#999999;stroke-width:0.409pt;" d=" M0.14,3.15
C0.14,3.15 3.27,0.15 3.27,0.15"/>
                                <path
style="fill:none;stroke:#999999;stroke-width:0.409pt;" d=" M3.31,3.45
C3.31,3.45 0.17,0.32 0.17,0.32"/>
                        </pattern>
                </defs>
                <g>
                        <pattern id="PATTERN_LINK_0_"
xlink:href="#MASTERPATTERN_0_" patternTransform="matrix(0.54, 0.00,
0.00, -0.54, 97.26, -693.33)">
                        </pattern>
                        <path
style="fill:url(#PATTERN_LINK_0_);stroke:#999999;stroke-width:0.540pt;"
d=" M8.19,0.26 C8.19,0.26 0.27,13.21 0.27,24.55 C0.27,24.55 26.55,32.11
33.38,33.38 C40.22,34.63 45.44,38.77 45.44,38.77 C45.44,38.77
47.05,10.14 49.02,7.26 C49.02,7.26 47.24,5.48 29.96,3.32 C12.69,1.16
8.19,0.26 8.19,0.26"/>
                </g>
        </svg>

I am converting this image to com.lowagie.text.Image with this code:

import java.awt.Graphics2D;
import java.awt.print.PageFormat;
import java.awt.print.Paper;

.
.
.

        String uri = new File(svgFile).toURI().toString();
          float width = ...
          float height = ...
        PdfContentByte cb = writer.getDirectContent();
        PdfTemplate template = cb.createTemplate(width, height);
        java.awt.Graphics2D g2d = template.createGraphics(width,
height);
        PrintTranscoder prm = new PrintTranscoder();
        TranscoderInput ti = new TranscoderInput(uri);
        prm.transcode(ti, null);
        PageFormat pg = new PageFormat();
        Paper pp = new Paper();
        pp.setSize(width, height);
        pp.setImageableArea(0, 0, width, height);
        pg.setPaper(pp);
        prm.print(g2d, pg, 0);
        g2d.dispose();
        Image image = Image.getInstance(template);

The image retains the color, but not the mesh.  

Any suggestions on how get the mesh into the image?  Using ImgTemplate
returns the same thing.

------------
Eli Segev


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

JonyGreen
This post has NOT been accepted by the mailing list yet.
In reply to this post by Eli Segev
I'm not a developer, i always use this free online pdf to image converter to convert pdf to image online.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

JonyGreen
This post has NOT been accepted by the mailing list yet.
In reply to this post by Eli Segev
I'm not a developer, i always use this free online pdf to image converter to convert pdf to image online
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Convert PDF to an Image

AdeleB
This post has NOT been accepted by the mailing list yet.
In reply to this post by Eli Segev
Loading...