Thanks,
Brian Lovett
IS - Dev Corporate Systems
Phone: (817) 722-7390
GameStop, Inc.
Power To The Players
625 Westport Parkway
Grapevine, TX 76051
THE INFORMATION IN THIS E-MAIL IS INTENDED FOR THE NAMED RECIPIENT (S) ONLY.  
IT MAY CONTAIN PRIVILEGED AND CONFIDENTIAL INFORMATION.  IF YOU HAVE RECEIVED 
THIS E-MAIL IN ERROR, PLEASE NOTIFY US IMMEDIATELY BY A RETURN E-MAIL, AND 
DELETE THIS E-MAIL


-----Original Message-----
From: [email protected] 
[mailto:[email protected]]
Sent: Wednesday, May 26, 2010 11:35
To: [email protected]
Subject: iText-questions Digest, Vol 48, Issue 87

Send iText-questions mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.sourceforge.net/lists/listinfo/itext-questions
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of iText-questions digest..."


Today's Topics:

   1. Re: How to set the pdf's name dynamically (Brian Lovett)
   2. Re: How to set the pdf's name dynamically (1T3XT info)
   3. Re: How to set the pdf's name dynamically (Erik Pfingsten)
   4. Question about converting HTML to PDF (Denys Hryvastov)
   5. Open an existing PDF instead of creating blank (QuietRiot)
   6. Re: Question about converting HTML to PDF (Mike Marchywka)
   7. Re: Open an existing PDF instead of creating blank (Glen Hamel)


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

Message: 1
Date: Wed, 26 May 2010 09:19:40 -0500
From: Brian Lovett <[email protected]>
Subject: Re: [iText-questions] How to set the pdf's name dynamically
To: "[email protected]"
        <[email protected]>
Message-ID:
        
<ce1ae16f7a9b7d45be0541f3d3303d4e4663db4...@vgv1hqpeb07exch.babgsetc.pvt>

Content-Type: text/plain; charset="us-ascii"

>From my experience, the "Content-Disposition" header works when you are saving 
>directly to disk.  If you open it in a reader first, then it is up to that 
>reader how it saves.  Based on the info presented, he is probably running in 
>an Apache environment, so I am not sure how what I am about to suggest 
>applies.  I run in a controlled Windows (IIS, IE, etc...) environment and we 
>use Adobe Reader.  Reader uses the end of the URL as the default name of the 
>file.  The way I resolved this was to set up a HTTP handler such that it 
>intercepts anything with something like "http://server/printable/"; in the URL. 
> You could then set the URL to be 
>"http://server/printable/filenameiwant.ashx";.  When you hit the save-as button 
>in Reader, it would then auto-fill the file name with "filenameiwant".

So I would recommend Googling "Apache http handler". ;)  I hope this helps!

Thanks,

Brian

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

Message: 9
Date: Wed, 26 May 2010 08:49:21 +0200
From: 1T3XT info <[email protected]>
Subject: Re: [iText-questions] How to set the pdf's name dynamically
        when using      servlet
To: Post all your questions about iText here
        <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Zhu, Yunpu wrote:
> I wanna decide pdf's name dynamically when I generate the pdf file using
> a servlet and Jsp. The pdf is shown in browser. When I click save as,
> the pop-up name is different during the different scenario.

That's not an iText question.
The name of the file is defined in the HTTP header
(Google for "Content-Disposition").
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info



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

Message: 2
Date: Wed, 26 May 2010 17:11:35 +0200
From: 1T3XT info <[email protected]>
Subject: Re: [iText-questions] How to set the pdf's name dynamically
To: Post all your questions about iText here
        <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Brian Lovett wrote:
> So I would recommend Googling "Apache http handler". ;)  I hope this helps!

Good suggestion.

I believe the OP is using Servlets and JSP. A more elegant solution
would be to drop JSP (it's NEVER a good idea to create ANY binary file
using JSP, IMHO creating PDF from JSP is a proof of bad design.)

With Servlets, you define a pattern in your web.xml file. If you define
a pattern with *.pdf, the Servlet creating or manipulating the PDF will
be triggered for every link with a filename that has the extension .pdf.
If I'm not mistaken, that's exactly the name that will be used when
downloading the file.
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info



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

Message: 3
Date: Wed, 26 May 2010 11:06:48 -0400
From: Erik Pfingsten <[email protected]>
Subject: Re: [iText-questions] How to set the pdf's name dynamically
To: 'Post all your questions about iText here'
        <[email protected]>
Message-ID:
        <5494f850ca19724fbd13c96baa610b60592b53a...@cinmail01.cinci.paycor.com>

Content-Type: text/plain; charset="us-ascii"

Setting the Content-Disposition Header will work if you are opening the file in 
Adobe Reader first also (ie it will pre-fill the filename in the Save As box, 
but the end user can then change the name).  That's what I do.

In C#:
String fileName = "whatever.pdf";
Response.AddHeader("Content-Disposition", string.Format("attachment; 
filename=\"{0}\"", fileName));

Erik Pfingsten


> -----Original Message-----
> From: Brian Lovett [mailto:[email protected]]
> Sent: Wednesday, May 26, 2010 10:20 AM
> To: [email protected]
> Subject: Re: [iText-questions] How to set the pdf's name dynamically
>
> >From my experience, the "Content-Disposition" header works when you are
> saving directly to disk.  If you open it in a reader first, then it is up
> to that reader how it saves.  Based on the info presented, he is probably
> running in an Apache environment, so I am not sure how what I am about to
> suggest applies.  I run in a controlled Windows (IIS, IE, etc...)
> environment and we use Adobe Reader.  Reader uses the end of the URL as
> the default name of the file.  The way I resolved this was to set up a
> HTTP handler such that it intercepts anything with something like
> "http://server/printable/"; in the URL.  You could then set the URL to be
> "http://server/printable/filenameiwant.ashx";.  When you hit the save-as
> button in Reader, it would then auto-fill the file name with
> "filenameiwant".
>
> So I would recommend Googling "Apache http handler". ;)  I hope this
> helps!
>
> Thanks,
>
> Brian
>
> -----Original Message-----
>
> Message: 9
> Date: Wed, 26 May 2010 08:49:21 +0200
> From: 1T3XT info <[email protected]>
> Subject: Re: [iText-questions] How to set the pdf's name dynamically
>       when using      servlet
> To: Post all your questions about iText here
>       <[email protected]>
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Zhu, Yunpu wrote:
> > I wanna decide pdf's name dynamically when I generate the pdf file using
> > a servlet and Jsp. The pdf is shown in browser. When I click save as,
> > the pop-up name is different during the different scenario.
>
> That's not an iText question.
> The name of the file is defined in the HTTP header
> (Google for "Content-Disposition").
> --
> This answer is provided by 1T3XT BVBA
> http://www.1t3xt.com/ - http://www.1t3xt.info
>
> --------------------------------------------------------------------------
> ----
>
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.itextpdf.com/book/
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/


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.




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

Message: 4
Date: Wed, 26 May 2010 18:30:42 +0300
From: Denys Hryvastov <[email protected]>
Subject: [iText-questions] Question about converting HTML to PDF
To: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Hi all -

I am using iText and I try to convert HTML to PDF using this library. It
works well for me with simple HTML.
The question that I have is: does iText support converting HTML which
includes css references and JavaScript to PDF? If I have JavaScript embedded
in my HTML will it work in the generated PDF? Is it a way to do this?

Thanks in advance,
    Denys
-------------- next part --------------
An HTML attachment was scrubbed...

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

Message: 5
Date: Wed, 26 May 2010 09:09:36 -0700 (PDT)
From: QuietRiot <[email protected]>
Subject: [iText-questions] Open an existing PDF instead of creating
        blank
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii



This should be easy but I'm having a hard time with it. I'm currently doing
the following:

// START OF DOCUMENT
response.setContentType("application/pdf");
Document document = new Document();

try{

ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, buffer);
document.open();

PdfFormField field = PdfFormField.createSignature(writer);
field.setWidget(new Rectangle(218, 577, 285, 589),
PdfAnnotation.HIGHLIGHT_INVERT);
field.setFieldName("mySig");
field.setFlags(PdfAnnotation.FLAGS_PRINT);
writer.addAnnotation(field);

// END OF DOCUMENT
document.close();

DataOutput dataOutput = new DataOutputStream(response.getOutputStream());
byte[] bytes = buffer.toByteArray();
response.setContentLength(bytes.length);
for(int i = 0; i < bytes.length; i++) {
        dataOutput.writeByte(bytes[i]);
  }

}catch(DocumentException e){
e.printStackTrace();
}


but I need to open an existing PDF at this location below and do the above.

String rootPath = System.getProperty("catalina.home");
rootPath = rootPath + File.separator + "webapps" + File.separator + "ROOT" +
File.separator;
rootPath = rootPath + "test/reportjsps/MyForm.pdf";

how would I modify the above so that it opens this existing PDF?


thanks

--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Open-an-existing-PDF-instead-of-creating-blank-tp2231939p2231939.html
Sent from the iText - General mailing list archive at Nabble.com.



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

Message: 6
Date: Wed, 26 May 2010 12:27:52 -0400
From: Mike Marchywka <[email protected]>
Subject: Re: [iText-questions] Question about converting HTML to PDF
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"











________________________________
> Date: Wed, 26 May 2010 18:30:42 +0300
> From: [email protected]
> To: [email protected]
> Subject: [iText-questions] Question about converting HTML to PDF
>
> Hi all -
>
> I am using iText and I try to convert HTML to PDF using this library. It 
> works well for me with simple HTML.
> The question that I have is: does iText support converting HTML which 
> includes css references and JavaScript to PDF? If I have JavaScript embedded 
> in my HTML will it work in the generated PDF? Is it a way to do this?

There is a webkit app that does this,

http://code.google.com/p/wkhtmltopdf/


I guess I would ask a related question that seems to be answered by
the above app, " has anyone considered
using itext or other tools with browsers such as webkit?" Presumably
webkit, as an example, knows how to render ( by definition almost it
is "right" as usually people want to copy what they see on [ some ] browser
even if there is not standard that captures quirks and bugs LOL ).
Apparently webkit generates things like DOM's and structures for drawing,
you could consider several ways to interface or "mix and match" tools.

For example, some JNI interface between your java app and a modified
webkit built OR an "intermediate language such that this would do something
useful:

webkit_tool -dump_render_tree http://xxx.com | java -jar my_itext_app> 
pdf_of_web.pdf


I will admit right now that much like "grep the source code" was my prior
answer for everything, webkit ( an opensource browser) seems like the answer
to everything that involves a browser.
>
>
> Thanks in advance,
> Denys

_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2


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

Message: 7
Date: Wed, 26 May 2010 12:32:11 -0400
From: "Glen Hamel" <[email protected]>
Subject: Re: [iText-questions] Open an existing PDF instead of
        creating blank
To: "'Post all your questions about iText here'"
        <[email protected]>
Message-ID: <000901cafcf0$fe4d4d70$fae7e8...@[email protected]>
Content-Type: text/plain;       charset="US-ASCII"

Technically this is not an iText issue but as I had the time to actually
respond this time, here it is..

You're doing that all wrong...

Create the PDF in a memory stream first.

Then use the following:
(do bear in mind that this is VB code but does lend to conversion to any
other language as I've done to C# myself).

                        HttpContext.Current.Response.Buffer = True
                        HttpContext.Current.Response.ClearContent()
                        HttpContext.Current.Response.ClearHeaders()
                        HttpContext.Current.Response.ContentType =
"application/pdf"

HttpContext.Current.Response.AddHeader("Content-Disposition",
"attachment;filename=" & usrnm & ".pdf")

HttpContext.Current.Response.BinaryWrite(mStream.GetBuffer())
                        HttpContext.Current.Response.End()

Glen Hamel
Auric Networks Canada, Inc.
570 Orwell Street, Unit 1
Mississauga, Ontario
L5A 3V7

Phone : 905.361.7621 x 204
Fax : 905.274.3912
Email : [email protected]

http://www.auricnet.ca

-----Original Message-----
From: QuietRiot [mailto:[email protected]]
Sent: Wednesday, May 26, 2010 12:10 PM
To: [email protected]
Subject: [iText-questions] Open an existing PDF instead of creating blank



This should be easy but I'm having a hard time with it. I'm currently doing
the following:

// START OF DOCUMENT
response.setContentType("application/pdf");
Document document = new Document();

try{

ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, buffer);
document.open();

PdfFormField field = PdfFormField.createSignature(writer);
field.setWidget(new Rectangle(218, 577, 285, 589),
PdfAnnotation.HIGHLIGHT_INVERT);
field.setFieldName("mySig");
field.setFlags(PdfAnnotation.FLAGS_PRINT);
writer.addAnnotation(field);

// END OF DOCUMENT
document.close();

DataOutput dataOutput = new DataOutputStream(response.getOutputStream());
byte[] bytes = buffer.toByteArray();
response.setContentLength(bytes.length);
for(int i = 0; i < bytes.length; i++) {
        dataOutput.writeByte(bytes[i]);
  }

}catch(DocumentException e){
e.printStackTrace();
}


but I need to open an existing PDF at this location below and do the above.

String rootPath = System.getProperty("catalina.home");
rootPath = rootPath + File.separator + "webapps" + File.separator + "ROOT" +
File.separator;
rootPath = rootPath + "test/reportjsps/MyForm.pdf";

how would I modify the above so that it opens this existing PDF?


thanks

--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Open-an-existing-PDF-instead-of-c
reating-blank-tp2231939p2231939.html
Sent from the iText - General mailing list archive at Nabble.com.

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

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

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.819 / Virus Database: 271.1.1/2897 - Release Date: 05/26/10
02:25:00




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

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



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

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


End of iText-questions Digest, Vol 48, Issue 87
***********************************************

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

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

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to