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="https://pd4ml.com/tlds/pd4ml/2.6" prefix="pd4ml"%> <%@page contentType="text/html; charset=UTF-8"%> <pd4ml:transform screenWidth="400" pageFormat="A5" pageOrientation="landscape" pageInsets="100,100,100,100,points" enableImageSplit="false"> <html> <head> <title>pd4ml test</title> <style type="text/css"> body { color: #000000; background-color: #FFFFFF; font-family: Tahoma, "Sans-Serif"; font-size: 10pt; } </style> </head> <body> Hello, World! ıüöİÖÜŞşÇç <pd4ml:page.break /> Hello, New Page! </body> </html> </pd4ml:transform>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 ...................................................................... 'Title: Test. 'This page will be used to testBuild any new functionality independently. '................................................................................................................ Imports org.zefer.pd4ml Imports System.IO ''' <summary> ''' ''' </summary> Partial Class PD4MLTest Inherits System.Web.UI.Page 'Protected Shared USAGE As String = "Usage: pd4net.exe '<url>' <htmlWidth> [pageFormat] [-permissions <NUMBER>]" & _ '"[-bookmarks <HEADINGS|ANCHORS>] [-orientation <PORTRAIT|LANDSCAPE>] " & _ '"[-ttf <ttf_fonts_dir>] [-out <output_file_path>]" Protected Shared strUsage As String Protected Shared USAGE As ArrayList = New ArrayList() ''' <summary> ''' Handles the Load event of the Page control. ''' </summary> ''' <param name="sender">The source of the event.</param> ''' <param name="e">The <see cref="System.EventArgs" /> instance containing the event data.</param> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load USAGE.Add("http://localhost:3013/web/Default.aspx") USAGE.Add(500) USAGE.Add("A4") USAGE.Add(1) USAGE.Add("HEADINGS") USAGE.Add("PORTRAIT") USAGE.Add("c:windowsfonts") USAGE.Add("C:P") 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)) Main(USAGE) 'Converter.generatePDF(infile, width, Format, permissions, bookmarks, Orientation, ttf, outfile) End Sub ''' <summary> ''' Generates the PDF. ''' </summary> ''' <param name="inputUrl">The input URL.</param> ''' <param name="htmlWidth">Width of the HTML.</param> ''' <param name="pageFormat">The page format.</param> ''' <param name="permissions">The permissions.</param> ''' <param name="bookmarks">The bookmarks.</param> ''' <param name="orientation">The orientation.</param> ''' <param name="fontsDir">The fonts dir.</param> ''' <param name="outfile">The outfile.</param> 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) Dim pd4ml As PD4ML = New PD4ML() pd4ml.HtmlWidth = htmlWidth If (orientation = Nothing Or orientation.Trim.Length = 0) Then orientation = "portrait" End If If ("PORTRAIT".Equals(orientation.ToUpper())) Then pd4ml.PageSize = PD4Constants.getSizeByName(pageFormat) Else pd4ml.PageSize = pd4ml.changePageOrientation(PD4Constants.getSizeByName(pageFormat)) End If If (permissions <> -1) Then pd4ml.setPermissions("empty", permissions, True) End If If (bookmarks <> Nothing AndAlso bookmarks.Trim.Length > 0) Then If ("ANCHORS".Equals(bookmarks.ToUpper())) Then pd4ml.generateOutlines(False) ElseIf ("HEADINGS".Equals(bookmarks.ToUpper())) Then pd4ml.generateOutlines(True) End If End If If (fontsDir <> Nothing AndAlso fontsDir.Length > 0) Then pd4ml.useTTF(fontsDir, True) End If If (outfile = Nothing OrElse outfile.Equals("-")) Then pd4ml.render(New Uri(inputUrl), Console.Out) Else pd4ml.render(New Uri(inputUrl), New System.IO.FileStream(outfile, System.IO.FileMode.Create)) End If End Sub ''' <summary> ''' Wrongs the param. ''' </summary> ''' <param name="msg">The MSG.</param> Protected Shared Sub wrongParam(ByVal msg As String) Console.Out.WriteLine("invalid parameter: " + msg) Console.Out.WriteLine(USAGE) End Sub ''' <summary> ''' Mains the specified args. ''' </summary> ''' <param name="args">The args.</param> Private Shared Sub Main(ByVal args As ArrayList) 'Private Shared Sub Main(ByVal args As string()) ' converter.generatePDF(infile, width, format, permissions, bookmarks, orientation, ttf, outfile) Dim infile As String = args(0).ToString Dim width As Integer = CInt(args(1)) Dim format As String = args(2).ToString Dim permissions As Integer = args(3).ToString Dim bookmarks As String = args(4).ToString Dim orientation As String = args(5).ToString Dim ttf As String = args(6).ToString Dim outfile As String = args(7).ToString Dim formatSet As Boolean = False Dim ff As FileInfo = Nothing Dim i As Integer For i = 0 To i < args.Count 'For i = 0 To i < args.Length If ("-permissions".Equals(args(i))) Then i = i + i 'If (i = args.Length) Then If (i = args.Count) Then wrongParam("missing permissions number (a sum of single permission codes)") Return End If permissions = Int32.Parse(args(i)) Continue For End If If ("-bookmarks".Equals(args(i))) Then i = i + i If (i = args.Count) Then wrongParam("missing bookmark type (HEADINGS or ANCHORS)") Return End If bookmarks = args(i) Continue For End If If ("-orientation".Equals(args(i))) Then i = i + i If (i = args.Count) Then wrongParam("missing orientation type (PORTRAIT or LANDSCAPE)") Return End If orientation = args(i) Continue For End If If ("-ttf".Equals(args(i))) Then i = i + i If (i = args.Count) Then wrongParam("missing TTF fonts directory") Return End If ff = New FileInfo(args(i)) ttf = ff.FullName Continue For End If If ("-out".Equals(args(i))) Then i = i + i If (i = args.Count) Then wrongParam("missing output file name") Return End If outfile = args(i) Continue For End If If (args(i).StartsWith("-")) Then wrongParam("unknown: " + args(i)) Return End If If (infile = Nothing) Then Dim ss As String = args(i) If Not (ss.StartsWith("http://") AndAlso ss.StartsWith("file://")) Then ff = New FileInfo(ss) infile = "file:///" & ff.FullName Else infile = ss End If Continue For End If If (width = -1) Then width = Int32.Parse(args(i)) Continue For End If If (Not formatSet) Then formatSet = True format = args(i) Continue For End If wrongParam(args(i)) Return Next i If (infile = Nothing) Then Console.Out.WriteLine("source URL is missing") Console.Out.WriteLine(USAGE) Return End If If (width = -1) Then Console.Out.WriteLine("HTML width parameter is missing") Console.Out.WriteLine(USAGE) Return End If Dim converter As PD4MLTest = New PD4MLTest converter.generatePDF(infile, width, format, permissions, bookmarks, orientation, ttf, outfile) End Sub End ClassThanks 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 https://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:
<table> <tr> <td> </td> </tr> </table>
, 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
