Forum Replies Created
-
AuthorPosts
-
in reply to: HTML rendering problem with width attribute July 11, 2011 at 20:25#28581
sorry wrong pdf file
i’ll update tomorow.in reply to: HTML rendering problem with width attribute July 12, 2011 at 08:28#28582Simple HTML
Bad render in PDF cf file join
[language=HTML:311s4b33]
TITRE
AAAABBB
[/language:311s4b33]in reply to: HTML rendering problem with width attribute July 12, 2011 at 12:08#28583As I see, the PDF is generated with PD4ML v321b3, which is quite old. Obviously it is from our sample Notes database.
If would make sense to replace it with the most recent version – in the meantime we addressed a lot of rendering issues. I’ve attached a PDF generated with one of the new versions – as for me it looks correct.
in reply to: HTML rendering problem with width attribute July 13, 2011 at 12:19#28584i’ve update again and it’s ok now.
first update wasn’t ok i think
thanks !in reply to: PD4ML Tips & Tricks July 14, 2011 at 08:05#26581Hello,
I am facing problem with PDF Width. I want to generate PDF keeping format as ledger (since input html is big report) and output pdf’s width 100%. But unfortunetly i was getting only 79.1%.How to solve this issue.
Below is the code snippet using to generate
pd4ml.fitPageVertically();
pd4ml.adjustHtmlWidth();
pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.LEDGER));in reply to: Problem with PDF Width July 14, 2011 at 08:08#28585Adding to the above post, we are using paid version of PD4ml
in reply to: HTML/CSS rendering issues July 14, 2011 at 08:49#26582Hello,
Iam a paid user. We have been using your product for quite a while. We are very much happy with this. Recently we have got one requirement ,where we have one big HTML Report needs to converted as PDF.We tried to make use of yours. But here when try to output as ledger type (11/17), pdf width is coming as 79.1% only. We need it 120% (atleaset 100%), since the font of 79.1% is non readable.
Below is the code snippet using to generate
pd4ml.fitPageVertically();
pd4ml.adjustHtmlWidth();
pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.LEDGER));Please help us as quickly as possible.
in reply to: Problem with output ledger type PDF Width July 14, 2011 at 09:48#28586Adding to the below issue, i would like to add my output pdf file for better understanding on the problem. Please let me know if you require input html file
We want whole pdf content to expand to its right.
in reply to: Problem with output ledger type PDF Width July 14, 2011 at 10:22#28587[language=java:3d8jgyrb]pd4ml.fitPageVertically();
pd4ml.adjustHtmlWidth();[/language:3d8jgyrb]Both API calls are intended to automatically compute htmlWidth value, which fulfills specific requirements. The first call increases htmlWidth (in other words scales down the document layout) until the document content fits a single page.
The second call cares, that top right content edge of the page is not cut.
If you call both methods the results are not predictable.
If I understand you correctly you would like to fill a single page horizontally and vertically with the document content. Please correct if I am wrong. PD4ML does not support the mode. However there is a relatively simple (but resource consuming) method to achieve that.
You need to increase htmlWidth in small amounts and render the document into a ByteArrayOutputStream. After each iteration control a relation between resulting document width and height (until the aspect ratio is the same as of PD4Constants.LEDGER). You may request the document height and width (in pixels) with the calls:
[language=java:3d8jgyrb]pd4ml.render(url, byteArrayOutputStream);
System.out.println(“height: ” + (Long)pd4ml.getLastRenderInfo(PD4Constants.PD4ML_DOCUMENT_HEIGHT_PX));
System.out.println(“right edge: ” + (Long)pd4ml.getLastRenderInfo(PD4Constants.PD4ML_RIGHT_EDGE_PX));[/language:3d8jgyrb]in reply to: HTML/CSS rendering issues July 14, 2011 at 10:59#26583Hello,
I’m facing a wired situation when a part of my HTML text is not showing up in the PDF.. The text is there, I know this because I can select it with the mouse an copy paste it into a text editor, but in the PDF it appears like it’s invisible and even when you highlight it it’s not visible in the PDF. The text from the next page is visible, if there is one, it’s visible again. If I put a page break where the invisible text begins the text appears correctly on the next page(it is visible).
Do you have any idea why this is happening? I tried the last version (b4) and the last stable one and in both cases the generated PDF looks the same.See attached the code used(HTML and JAVA) to generate the PDF.
Thank you in advance,
Adrian.in reply to: Text is not showing up in the pdf July 14, 2011 at 11:37#28597A PDF sample would help a lot to determine the problem reason.
in reply to: Text is not showing up in the pdf July 14, 2011 at 11:57#28598Sure, check out the second page at the bottom.
in reply to: Problem with output ledger type PDF Width July 14, 2011 at 12:03#28588Thanks for you reply..
Now i removed pd4ml.adjustHtmlWidth() call. Yes you are right. I need to fill a single page horizontally and vertically with the document content. In the attached output pdf in my previous thread you can see content is not expanding to the right.
Also i couldnot understand this ByteArrayOutputStream . I could only get output pdf if i use fileoutputstream object.
I hope you understood the problem iam facing. Vertically it is coming fine. When it comes to horizontally content is not expanding 100%.
Could you please suggest me code to use ByteArrayoutputstream .
As of now this is my current code..
java.io.FileOutputStream fos = new java.io.FileOutputStream(“C:/ouputPdf.pdf”);
PD4ML pd4ml = new PD4ML();
pd4ml.fitPageVertically();
pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.LEDGER));
pd4ml.render(“file:” + inputHTMLFileName, fos );
in reply to: Text is not showing up in the pdf July 14, 2011 at 12:20#28599It is difficult to say if it is caused by an inconsistent structure of nested DIVs or it is an error of our HTML normalizer.
I resolved the issue on my PC after I removed one closing tag. See below.
[language=xml:1o3yyld4]82%
[/language:1o3yyld4]We’ll investigate the issue.
in reply to: Problem with output ledger type PDF Width July 14, 2011 at 12:42#28589Schematically it looks like that:
[language=java:2bwk47xo]double desiredRatio = (double)PD4Constants.LEDGER.width / PD4Constants.LEDGER.height;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for ( int i = 0; i < 40; i++ ) { int width = 900 + (i * 20); pd4ml.setHtmlWidth( width ); pd4ml.render(urls, baos); int height = ((Long)pd4ml.getLastRenderInfo(PD4Constants.PD4ML_DOCUMENT_HEIGHT_PX)).intValue(); // width = ((Long)pd4ml.getLastRenderInfo(PD4Constants.PD4ML_RIGHT_EDGE_PX)).intValue(); // for special cases double actualRatio = (double)width / height; if ( actualRatio < desiredRatio * 1.1 && actualRatio > desiredRatio * 0.9 ) {
break;
}baos.reset();
}fos.write( baos.toByteArray() );
fos.close();[/language:2bwk47xo]The numeric constant values (width step, number of steps, matching aspect ratio scope) have no special meaning, so they needs to be adjusted for your particular case.
And please take into account, each render() call is a resource consuming task, so it makes sense to reduce a number of calls to the possible minimum.
-
AuthorPosts