Forum Replies Created
-
AuthorPosts
-
in reply to: .NET and MediumTrust July 14, 2011 at 12:57#28572
We’ve just build the new version with the attribute added (excl. the version for Mono platform). The version is currently being tested. Please contact support pd4ml com if you would like to test in on your side.
in reply to: Problem with output ledger type PDF Width July 14, 2011 at 12:42#28589Schematically it looks like that:
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();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.
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
</div>tag. See below.82%</td> </tr> </tbody> </table> </div> </remove-the-closing-div> <!-- <hr class="bbcode_rule" /> --> <!-- <hr class="bbcode_rule" /> Meeting Past Actions section <hr class="bbcode_rule" /> --> <!-- <hr class="bbcode_rule" /> --> <div style="border-bottom: 4px solid #95b3d7; padding: 10px;font-size: 18px;">
We’ll investigate the issue.
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: Problem with output ledger type PDF Width July 14, 2011 at 10:22#28587pd4ml.fitPageVertically(); pd4ml.adjustHtmlWidth();
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:
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));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: Not all Images loading (has zero length) July 11, 2011 at 19:19#28574The issue is quite strange. Could you please send an HTML (and/or JSP) code sample and ON/OFF images to support pd4ml com.
The best solution would be to tune the relative image paths to work. We’ll check what could be done.
in reply to: background-position July 11, 2011 at 13:22#28577Marcus, please download the most recent beta and give a try to top, left and percentage attributes. The online documentation is not always up to date.
PD4ML GUI tool should make the experimenting easier:
java -Xmx512m -jar pd4ml.jarin reply to: i have bought PD4ml and facing font issue July 10, 2011 at 10:17#28576PD4ML (or Java in general) supports Unicode-conformant TTF fonts only (whose glyph mappings are stored in the ‘cmap’ table). It is true for most of the modern fonts, but there are still many legacy fonts, which do not fulfill the requirement. Obviously the problematic font is one of them.
The fonts cannot be used with PD4ML (or Java) as is. I would recommend to open and save as TTF again using free Fontforge utility.
(google for a preconfigured FontForge + Cygwin with the following keyword: “fontforge-mingw_2008_11_21“)
A better solution is to find a newer Unicode-conformant substitution font for it.
in reply to: UTF – 8 char issue July 5, 2011 at 11:13#28566As I see you packed TTF fonts into a JAR and correctly refer them:
pd4ml.useTTF( “java:fonts”, true )
It looks like your JAR has only popular fonts like Arial, Courier etc. Normally the fonts do not include Asian glyphs. In order to cover the character space please add to the JAR fonts like MS Mincho, MS Gothic, MingLiU and SimSun from any Win32 distribution (you can find them in windowsfonts).
Here are the entire font name lists, PD4ML tries to use in order to display international texts:
post1638.html?#p1638in reply to: UTF – 8 char issue July 1, 2011 at 11:51#28564In order to display Asian characters you need to utilize TTF embedding feature of PD4ML Pro:
in reply to: page-break-inside: avoid Not Working June 24, 2011 at 19:25#27557page-break-inside: avoid protects HTML element from being split.
It forces a page break before table2 if there is a chance to keep table2 not broken. If table2 height is higher than page height – it does not force a page break, as the table will be broken in any case. If also does not force a page break if table2 fits the remaining space on a page.
So if I understand you correctly, it works on your side as it should do.
If you need to force a page break, you may use
<pd4ml:page.break>tag or page-break-before: always CSS style applied to a block element.in reply to: Getting Empty PDF June 24, 2011 at 09:54#28563Closing or tags are interpreted as a document end. PD4ML ignores any following HTML code.
in reply to: localhost works, http don’t June 20, 2011 at 19:56in reply to: can not change default encoding Cp1252 to UTF8 as specified June 14, 2011 at 13:11#28560A good workaround would be to use render(URL,…) method instead of render(InputStream,…)
Another solution is to pre-read the source HTML into a byte array and to pass it to PD4ML.render() as a ByteArrayInputStream
Also you may run JVM with -file.encoding=UTF8 command-line parameter or to use a render() method, which accepts an encoding name as a parameter, but in the case your Java code is going to be dependent on the document content you are going to convert.
-
AuthorPosts
