Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within XML
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830
this week in the
Programmer Certification
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
XML and Related Technologies
Div inner Html to PDF
Atul Darne
Ranch Hand
Posts: 119
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi guys,
I have a page designed in html and has Div tags in it,
i want to make a PDF of the inner html in the div,
how can i achieve it ?
any way to achieve this ?
Regards, Atul.
I came to this world on a Learner's License
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Have you researched PDF creating tools in
java
? That would seem to me to be the first step.
Bill
Atul Darne
Ranch Hand
Posts: 119
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
iam using iText libraries for converting HTML to PDF, but i need to add the forms, swf files and images to the created PDF.
Regards, Atul.
I came to this world on a Learner's License
Ulf Dittmer
Rancher
Posts: 43081
77
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
iText can handle forms and images. I don't think there's a way to embed SWF in PDFs, and if there is, I'm just about certain that iText does not support it.
Atul Darne
Ranch Hand
Posts: 119
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i tried embedding ready swf file in the pdf using the itext, it works fine.
here is the code
import java.io.FileOutputStream; import java.io.IOException; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Rectangle; import com.itextpdf.text.pdf.PdfAnnotation; import com.itextpdf.text.pdf.PdfDeveloperExtension; import com.itextpdf.text.pdf.PdfFileSpecification; import com.itextpdf.text.pdf.PdfIndirectReference; import com.itextpdf.text.pdf.PdfName; import com.itextpdf.text.pdf.PdfWriter; import com.itextpdf.text.pdf.richmedia.RichMediaActivation; import com.itextpdf.text.pdf.richmedia.RichMediaAnnotation; import com.itextpdf.text.pdf.richmedia.RichMediaConfiguration; import com.itextpdf.text.pdf.richmedia.RichMediaInstance; import com.itextpdf.text.pdf.richmedia.RichMediaParams; public class SWF { /** The resulting PDF file. */ public static final String RESULT = "D:/testfiles/guitar.pdf"; /** The path to a Flash application. */ public static final String RESOURCE = "D:/testfiles/guitar11.swf"; /** * Main method. * * @param args no arguments needed * @throws DocumentException * @throws IOException */ public static void main(String[] args) throws IOException, DocumentException { // step 1 Document document = new Document(); // step 2 PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(RESULT)); writer.setPdfVersion(PdfWriter.PDF_VERSION_1_7); writer.addDeveloperExtension(PdfDeveloperExtension.ADOBE_1_7_EXTENSIONLEVEL3); // step 3 document.open(); // step 4 // we prepare a RichMediaAnnotation RichMediaAnnotation richMedia = new RichMediaAnnotation(writer, new Rectangle(36, 400, 559,806)); // we embed the swf file PdfFileSpecification fs = PdfFileSpecification.fileEmbedded(writer, RESOURCE, "guitar11.swf", null); // we declare the swf file as an asset PdfIndirectReference asset = richMedia.addAsset("guitar11.swf", fs); // we create a configuration RichMediaConfiguration configuration = new RichMediaConfiguration(PdfName.FLASH); RichMediaInstance instance = new RichMediaInstance(PdfName.FLASH); RichMediaParams flashVars = new RichMediaParams(); instance.setParams(flashVars); instance.setAsset(asset); configuration.addInstance(instance); // we add the configuration to the annotation PdfIndirectReference configurationRef = richMedia.addConfiguration(configuration); // activation of the rich media RichMediaActivation activation = new RichMediaActivation(); activation.setConfiguration(configurationRef); richMedia.setActivation(activation); // we add the annotation PdfAnnotation richMediaAnnotation = richMedia.createAnnotation(); richMediaAnnotation.setFlags(PdfAnnotation.FLAGS_PRINT); writer.addAnnotation(richMediaAnnotation); // step 5 document.close(); System.out.println("Done"); } }
now the issue is , my swf file is a fusion chart file that iam using, which gets the data on fly. iam not having a swf file on disk to embed.
any way to get this solve ?
Regards, Atul.
I came to this world on a Learner's License
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
need to place a img element right after a select element, how?
rendering PDf in a JSP page.
JS slide
Element positioning problem
Render recaptcha via js.erb
how to save online application form (html page) as pdf file in desktop
More...