Forum Replies Created
-
AuthorPosts
-
in reply to: Troubleshooting July 16, 2010 at 09:12#26418
Hello,
I am tring to get a PDF report from a java web project. I am using eclipse helios tomcat server 7.0.
What I am tring to do is getting a html report as pdf. The jsp taglib seems great but i have a problem at Turkish chars (they don’t shown right at pdf reports).
I have downloaded pd4ml.pro.trial.361b1.zip and added the taglib project to eclipse.
But the jsp file doesn’t give me a correct chars.
<%@ taglib uri="http://pd4ml.com/tlds/pd4ml/2.6" prefix="pd4ml"%><br /> <%@page contentType="text/html; charset=UTF-8"%><br /> <pd4ml:transform screenWidth="400" pageFormat="A5"<br /> pageOrientation="landscape" pageInsets="100,100,100,100,points"<br /> enableImageSplit="false"><br /> <br /> <html><br /> <head><br /> <title>pd4ml test</title><br /> <style type="text/css"><br /> body {<br /> color: #000000;<br /> background-color: #FFFFFF;<br /> font-family: Tahoma, "Sans-Serif";<br /> font-size: 10pt;<br /> }<br /> </style><br /> </head><br /> <body><br /> <br /> Hello, World! ıüöİÖÜŞşÇç<br /> <br /> <pd4ml:page.break /><br /> <br /> Hello, New Page!<br /> <br /> </body><br /> </html><br /> </pd4ml:transform><br />
Any help would be great.in reply to: General questions / FAQ July 16, 2010 at 18:00#26419Hello PD4ML Support Team,
I am using the below posted code to generate PD4ML from asp.net application. Every thing till the file creation process works fine except it is throwing a permissions error when application tried to save the PDF. I am an admin on my Box. Can you help me to solve the permissions issue please?
Same time Can you also validate the stuff that I am doing below is proper as well.
{I did use VB.NET with framework 3.5 and PD4ML.NET during this task.Hope this helps}
'.................Purpose of the File ......................................................................<br /> 'Title: Test.<br /> 'This page will be used to testBuild any new functionality independently.<br /> '................................................................................................................<br /> Imports org.zefer.pd4ml<br /> Imports System.IO<br /> <br /> ''' <summary><br /> '''<br /> ''' </summary><br /> Partial Class PD4MLTest<br /> Inherits System.Web.UI.Page<br /> 'Protected Shared USAGE As String = "Usage: pd4net.exe '<url>' <htmlWidth> [pageFormat] [-permissions <NUMBER>]" & _<br /> '"[-bookmarks <HEADINGS|ANCHORS>] [-orientation <PORTRAIT|LANDSCAPE>] " & _<br /> '"[-ttf <ttf_fonts_dir>] [-out <output_file_path>]"<br /> <br /> Protected Shared strUsage As String<br /> Protected Shared USAGE As ArrayList = New ArrayList()<br /> <br /> <br /> <br /> ''' <summary><br /> ''' Handles the Load event of the Page control.<br /> ''' </summary><br /> ''' <param name="sender">The source of the event.</param><br /> ''' <param name="e">The <see cref="System.EventArgs" /> instance containing the event data.</param><br /> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br /> USAGE.Add("http://localhost:3013/web/Default.aspx")<br /> USAGE.Add(500)<br /> USAGE.Add("A4")<br /> USAGE.Add(1)<br /> USAGE.Add("HEADINGS")<br /> USAGE.Add("PORTRAIT")<br /> USAGE.Add("c:windowsfonts")<br /> USAGE.Add("C:P")<br /> strUsage = String.Format("Usage: pd4net.exe {0}, {1}, {2}, -permissions {3}, -bookmarks {4}, -orientation {5}, - ttf {6},-out {7}", USAGE(0), USAGE(1), USAGE(2), USAGE(3), USAGE(4), USAGE(5), USAGE(6), USAGE(7))<br /> Main(USAGE)<br /> 'Converter.generatePDF(infile, width, Format, permissions, bookmarks, Orientation, ttf, outfile)<br /> End Sub<br /> ''' <summary><br /> ''' Generates the PDF.<br /> ''' </summary><br /> ''' <param name="inputUrl">The input URL.</param><br /> ''' <param name="htmlWidth">Width of the HTML.</param><br /> ''' <param name="pageFormat">The page format.</param><br /> ''' <param name="permissions">The permissions.</param><br /> ''' <param name="bookmarks">The bookmarks.</param><br /> ''' <param name="orientation">The orientation.</param><br /> ''' <param name="fontsDir">The fonts dir.</param><br /> ''' <param name="outfile">The outfile.</param><br /> Protected Sub generatePDF(ByVal inputUrl As String, ByVal htmlWidth As Integer, ByVal pageFormat As String, ByVal permissions As Integer, ByVal bookmarks As String, ByVal orientation As String, ByVal fontsDir As String, ByVal outfile As String)<br /> Dim pd4ml As PD4ML = New PD4ML()<br /> <br /> pd4ml.HtmlWidth = htmlWidth<br /> <br /> If (orientation = Nothing Or orientation.Trim.Length = 0) Then<br /> orientation = "portrait"<br /> End If<br /> <br /> If ("PORTRAIT".Equals(orientation.ToUpper())) Then<br /> pd4ml.PageSize = PD4Constants.getSizeByName(pageFormat)<br /> Else<br /> pd4ml.PageSize = pd4ml.changePageOrientation(PD4Constants.getSizeByName(pageFormat))<br /> End If<br /> <br /> If (permissions <> -1) Then<br /> pd4ml.setPermissions("empty", permissions, True)<br /> End If<br /> <br /> If (bookmarks <> Nothing AndAlso bookmarks.Trim.Length > 0) Then<br /> If ("ANCHORS".Equals(bookmarks.ToUpper())) Then<br /> pd4ml.generateOutlines(False)<br /> ElseIf ("HEADINGS".Equals(bookmarks.ToUpper())) Then<br /> pd4ml.generateOutlines(True)<br /> End If<br /> End If<br /> <br /> If (fontsDir <> Nothing AndAlso fontsDir.Length > 0) Then<br /> pd4ml.useTTF(fontsDir, True)<br /> End If<br /> <br /> If (outfile = Nothing OrElse outfile.Equals("-")) Then<br /> pd4ml.render(New Uri(inputUrl), Console.Out)<br /> Else<br /> pd4ml.render(New Uri(inputUrl), New System.IO.FileStream(outfile, System.IO.FileMode.Create))<br /> End If<br /> End Sub<br /> ''' <summary><br /> ''' Wrongs the param.<br /> ''' </summary><br /> ''' <param name="msg">The MSG.</param><br /> Protected Shared Sub wrongParam(ByVal msg As String)<br /> Console.Out.WriteLine("invalid parameter: " + msg)<br /> Console.Out.WriteLine(USAGE)<br /> End Sub<br /> <br /> <br /> <br /> ''' <summary><br /> ''' Mains the specified args.<br /> ''' </summary><br /> ''' <param name="args">The args.</param><br /> Private Shared Sub Main(ByVal args As ArrayList)<br /> 'Private Shared Sub Main(ByVal args As string())<br /> ' converter.generatePDF(infile, width, format, permissions, bookmarks, orientation, ttf, outfile)<br /> Dim infile As String = args(0).ToString<br /> Dim width As Integer = CInt(args(1))<br /> Dim format As String = args(2).ToString<br /> Dim permissions As Integer = args(3).ToString<br /> Dim bookmarks As String = args(4).ToString<br /> Dim orientation As String = args(5).ToString<br /> Dim ttf As String = args(6).ToString<br /> Dim outfile As String = args(7).ToString<br /> Dim formatSet As Boolean = False<br /> Dim ff As FileInfo = Nothing<br /> Dim i As Integer<br /> <br /> For i = 0 To i < args.Count<br /> 'For i = 0 To i < args.Length<br /> <br /> If ("-permissions".Equals(args(i))) Then<br /> i = i + i<br /> 'If (i = args.Length) Then<br /> If (i = args.Count) Then<br /> wrongParam("missing permissions number (a sum of single permission codes)")<br /> Return<br /> End If<br /> permissions = Int32.Parse(args(i))<br /> Continue For<br /> End If<br /> <br /> If ("-bookmarks".Equals(args(i))) Then<br /> i = i + i<br /> If (i = args.Count) Then<br /> wrongParam("missing bookmark type (HEADINGS or ANCHORS)")<br /> Return<br /> End If<br /> bookmarks = args(i)<br /> Continue For<br /> End If<br /> <br /> If ("-orientation".Equals(args(i))) Then<br /> i = i + i<br /> If (i = args.Count) Then<br /> wrongParam("missing orientation type (PORTRAIT or LANDSCAPE)")<br /> Return<br /> End If<br /> orientation = args(i)<br /> Continue For<br /> End If<br /> <br /> If ("-ttf".Equals(args(i))) Then<br /> i = i + i<br /> If (i = args.Count) Then<br /> wrongParam("missing TTF fonts directory")<br /> Return<br /> End If<br /> ff = New FileInfo(args(i))<br /> ttf = ff.FullName<br /> Continue For<br /> End If<br /> <br /> If ("-out".Equals(args(i))) Then<br /> i = i + i<br /> If (i = args.Count) Then<br /> wrongParam("missing output file name")<br /> Return<br /> End If<br /> outfile = args(i)<br /> Continue For<br /> End If<br /> <br /> If (args(i).StartsWith("-")) Then<br /> wrongParam("unknown: " + args(i))<br /> Return<br /> End If<br /> <br /> If (infile = Nothing) Then<br /> Dim ss As String = args(i)<br /> If Not (ss.StartsWith("http://") AndAlso ss.StartsWith("file://")) Then<br /> ff = New FileInfo(ss)<br /> infile = "file:///" & ff.FullName<br /> Else<br /> infile = ss<br /> End If<br /> Continue For<br /> End If<br /> <br /> If (width = -1) Then<br /> width = Int32.Parse(args(i))<br /> Continue For<br /> End If<br /> <br /> If (Not formatSet) Then<br /> formatSet = True<br /> format = args(i)<br /> Continue For<br /> End If<br /> wrongParam(args(i))<br /> Return<br /> Next i<br /> <br /> If (infile = Nothing) Then<br /> Console.Out.WriteLine("source URL is missing")<br /> Console.Out.WriteLine(USAGE)<br /> Return<br /> End If<br /> <br /> If (width = -1) Then<br /> Console.Out.WriteLine("HTML width parameter is missing")<br /> Console.Out.WriteLine(USAGE)<br /> Return<br /> End If<br /> <br /> Dim converter As PD4MLTest = New PD4MLTest<br /> converter.generatePDF(infile, width, format, permissions, bookmarks, orientation, ttf, outfile)<br /> <br /> End Sub<br /> End Class
Thanks and Regards,
Venkyin reply to: Incorrect layout in generated PDF July 16, 2010 at 21:35#27994Thanks. I was sure I had tried that, but I guess I must not have.
in reply to: images with height in percentage July 16, 2010 at 21:37#27983Adrian,
PD4ML does not support as, in most of the situations, there is no base to compute percentual heights, but width=”100%” should work.
> The second problem I have is that I have a html very large horizontally.
> Is there a way to stretch the html to fit a pdf page?Try to increase htmlWidth conversion parameter to exceed the table width.
in reply to: Rendering images July 16, 2010 at 21:39#27360If an tag has no height/width attributes, PD4ML uses the original pixel dimensions of the image.
If the image does not fit PDF page width, you need to adjust HTML-to-PDF scaling factor.
HTML->PDF conversion is performed in two steps: HTML rendering – it uses htmlWidth parameter (aka screenWidth in PD4ML JSP taglib) as virtual web browser frame width, and PDF output – it maps the htmlWidth to the horizontal width of choosen paper format.
If a particular image does not fit horizontally PDF page, that means, the image is wider than htmlWidth.
In the case you have two options:
- increase htmlWidth value (default is 640)
- scale down the image with height and width attributes of tag
in reply to: Double byte support July 16, 2010 at 21:40#27890Obviously in pd4fonts.properties there is a line
code2000=font.ttf
Just substitute it with
code2000=anotherfont.ttf
and make anotherfont.ttf exists and readable
in reply to: Broken rendering under Linux, working properly under Windows July 19, 2010 at 10:11#28085A HTML sample would help a lot to analyze the problem reasons.
Could you please attach it to a post or send it directly to support pd4ml com
in reply to: Connection timed out … July 19, 2010 at 10:26#28077Ok!
I find this problem:
version: PD4ML 360fx1b1 Pro
https://193.204.6.37:30443/…/..cc65a0acd.xml not found.
java.net.ConnectException: Connection timed out
…
the file in not available for https via 30443 port! 🙁Why?
Thanks
in reply to: Connection timed out … July 19, 2010 at 12:12#28078Maybe I find the solution, but I have another issue for you!
I can access to the file also in this way:
https://127.0.0.1/…/..cc65a0acd.xml
but only without check certificate.
For example, this work:
wget –no-check-certificate https://127.0.0.1/…/..cc65a0acd.xml
and this doesn’t work:
wget https://127.0.0.1/…/..cc65a0acd.xml
How can I tell to pd4ml to access to the file with something like “–no-check-certificate” option?
Thanks
Mkin reply to: Connection timed out … July 19, 2010 at 12:59#28079mmm…
can’t I access to the file with a localPath and not with a url?
Thanks
Mkin reply to: How to generate pdf for constrained urls July 19, 2010 at 19:37#27599It depends on the server side session mechanism of you web application. You need to propagate the session ID correctly with the URL passed to PD4ML.
For the regular J2EE application a solution is to add the jsessionid parameter to URLs:
http://your.server.net/webapp/sourcepage.jsp;jsessionid=8764587625?param1=value1¶m2=value2
in reply to: PD4PageMark doesn’t align tables July 19, 2010 at 21:36in reply to: General questions / FAQ July 20, 2010 at 02:23#26421Hello
I am using pd4ml.net to create dynamic pdfs.
When I am providing an output file to generatePDF method, i am getting permission denied error, if not i am getting the below error.
‘Unable to translate bytes [C7] at index -1 from specified code page to Unicode.’
I am trying to make it work since two weeks. looking for some assistance in this regard please.I greatly appreciate your help to make this working.
Thanks and Regards,
Venkyin reply to: Connection timed out … July 20, 2010 at 09:57#28080Oficially PD4ML does not support HTTPS, however on practice it tries to load HTTPS resources with Java’s standard SSL classes.
WebSphere and Weblogic, for example, and may be some others implement their own SSL libraries, not derived from Java’s standard one. As a result it causes ClassCastException. As I see, it is not your case, but there may be other SSL protocol related issues, specific for your environment.
The best workaround for the HTTPS issue is not to use HTTPS for CSS or image references. It is expensive from the performance perspective and causes undesired network transactions. A better approach is to reference the resources with relative links.
If your source HTML documents are read-only and you are not allowed to change HTTPS URLs there, there is also a solution with custom resource loaders. You may implement your own one and to use any SSL library you like:
pd4ml-html-css-pdf-tips-tricks-f7/a-definition-of-custom-resource-loaders-t40.html
Also http://pd4ml.com/examples.zip include source codes of SSL servlet, where you could borrow some ideas from (for example how to suppress a certificate check).
in reply to: Header Footer Issues July 20, 2010 at 11:52#27953Yes. I would recommend to use <pd4ml:page.header> for that:
[language=xml:3qj48yoa]
[/language:3qj48yoa]
, you mentioned, is a custom JSP tag, mapped to PD4ML API – so it works only in JSP container. More info about PD4ML headers/footers: html-pdf-faq-f1/pdf-page-headers-footers-definition-options-t41.html
-
AuthorPosts