Closed varun-prathap closed 9 years ago
Hi,
again, you have to set the namespace correctly... which is not done on your document.
As such, yahp namespace is not defined.
Your header should be defined like this:
See the example there: http://www.allcolor.org/YaHPConverter/samples/example.pagebreak.html Regards, Quentin 2015-06-09 19:44 GMT+02:00 varun-prathap notifications@github.com: > Hi, > > Shown below is a code snippet where the PDF Conversion breaks. If I remove > the 'yahp:pb' tag from 'div id="div2"', conversion works fine. However, the > actual code has lot of dynamically generated nested divs. > > > > Approved > > 1-Incentive - 1 > > ``` >Approved
> |
>
---|
Hi,
Even if I add the namespace, it still breaks. The issue I've seen is that the converter doesn't seem to like the second div 'id="div2"'. If I remove that 'div', the second yahp:pb works fine.
Any guesses ? Thanks.
Also, I tried this basic setup which also breaks.
Again here, the issue is with the yahp:pb tab inside the second table. If I remove the yahp:pb tag from the second table and place it only in the first table, the conversion works. Bit puzzled here :(
This is the exception that I get, Exception in thread "main" org.allcolor.yahp.converter.IHtmlToPdfTransformer$CConvertException: ERROR: An unhandled exception occured: null at org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer.transform(CHtmlToPdfFlyingSaucerTransformer.java:791) at org.allcolor.yahp.converter.CYaHPConverter.convertToPdf(CYaHPConverter.java:172) at PDFGenerator.generatePDFFile(PDFGenerator.java:71) at PDFGenerator.main(PDFGenerator.java:26) Caused by: java.lang.NullPointerException at org.allcolor.yahp.cl.converter.CDocumentCut.cut(CDocumentCut.java:308) at org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer.transform(CHtmlToPdfFlyingSaucerTransformer.java:655) ... 3 more Destroying YAHP ClassLoader Tree Exception in thread "AWT-Windows" java.lang.IllegalStateException: Shutdown in progress at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66) at java.lang.Runtime.addShutdownHook(Runtime.java:211) at sun.awt.windows.WToolkit$2.run(WToolkit.java:279) at java.security.AccessController.doPrivileged(Native Method) at sun.awt.windows.WToolkit.registerShutdownHook(WToolkit.java:264) at sun.awt.windows.WToolkit.run(WToolkit.java:290) at java.lang.Thread.run(Thread.java:744)
No without any stacktrace or a description of the result you get... I can't help you.
Also without the namespace, it simply cannot work at all, it cannot possibly do any page break... so I don't know how it could work at your end just by removing the div and not setting the namespace.
2015-06-09 22:35 GMT+02:00 varun-prathap notifications@github.com:
Also, I tried this basic setup which also breaks.
[image: capture1] https://cloud.githubusercontent.com/assets/7615049/8068925/38ba59d0-0ec5-11e5-8114-9e48e28fb8a3.PNG
Again here, the issue is with the yahp:pb tab inside the second table. If I remove the yahp:pb tag from the second table and place it only in the first table, the conversion works. Bit puzzled here :(
— Reply to this email directly or view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/35#issuecomment-110496633 .
All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)
Hi,
If you see my last comment, the pic shows the code snippet (with the namespace "xmlns:yahp=..." added) along with the execution stacktrace that I get.
Would you need anything else ? Thanks.
You still did not explain what's the problem, what result you get, and what you're expecting getting...
Why do you put a page break inside a div ? what do you expect happen ? Why not putting it outside the div ?
Quentin
2015-06-10 16:37 GMT+02:00 varun-prathap notifications@github.com:
Hi,
If you see my last comment, the pic shows the code snippet (with the namespace "xmlns:yahp=..." added) along with the execution stacktrace that I get.
Would you need anything else ? Thanks.
— Reply to this email directly or view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/35#issuecomment-110777161 .
All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)
Ok the email did swallow the exception... I'm looking at what could be the problem.
2015-06-10 16:40 GMT+02:00 Quentin Anciaux allcolor@gmail.com:
You still did not explain what's the problem, what result you get, and what you're expecting getting...
Why do you put a page break inside a div ? what do you expect happen ? Why not putting it outside the div ?
Quentin
2015-06-10 16:37 GMT+02:00 varun-prathap notifications@github.com:
Hi,
If you see my last comment, the pic shows the code snippet (with the namespace "xmlns:yahp=..." added) along with the execution stacktrace that I get.
Would you need anything else ? Thanks.
— Reply to this email directly or view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/35#issuecomment-110777161 .
All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)
All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)
So looking at the code:
Node pb = ((Element) c).getElementsByTagNameNS(" http://www.allcolor.org/xmlns/yahp","pb").item(0);
And pb is null... that means, the namespace seems lost when the node is adopted in the new document... it's strange.
As a workaround try to set the tag like this;
Regards
2015-06-10 16:42 GMT+02:00 Quentin Anciaux allcolor@gmail.com:
Ok the email did swallow the exception... I'm looking at what could be the problem.
2015-06-10 16:40 GMT+02:00 Quentin Anciaux allcolor@gmail.com:
You still did not explain what's the problem, what result you get, and what you're expecting getting...
Why do you put a page break inside a div ? what do you expect happen ? Why not putting it outside the div ?
Quentin
2015-06-10 16:37 GMT+02:00 varun-prathap notifications@github.com:
Hi,
If you see my last comment, the pic shows the code snippet (with the namespace "xmlns:yahp=..." added) along with the execution stacktrace that I get.
Would you need anything else ? Thanks.
— Reply to this email directly or view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/35#issuecomment-110777161 .
All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)
All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)
All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)
Thanks much, when I replaced 'yahp:pb' with 'pb xmlns="http://www.allcolor.org/xmlns/yahp"', it is working fine now.
Once again, thanks for your time.
I'm trying to achieve this (see picture below),
But currently I'm getting this (see picture below),
This is the sample snippet code for achieving the above result,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:yahp="http://www.allcolor.org/xmlns/yahp" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body style="background: none;">
<div id="container">
<div id="pageBody">
<div id="Content">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form1 noborder" >
<tr>
<th colspan="4">Program Information</th>
</tr>
<tbody id="box101">
<tr>
<td class="label" width="20%">Program Description:</td>
</tr>
</tbody>
</table>
<div wicket:id="incentivesRepView">
<pb xmlns="http://www.allcolor.org/xmlns/yahp" />
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form1 noborder">
<tr>
<th colspan="4"><div wicket:id="incentiveStatus" class="status">1-Incentive - 1 Approved</div>
</tr>
<tbody id="box212">
<tr>
<td style="padding: 0px; border: none;">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form1 noborder">
<tr wicket:id="barcodeTr" id="barcodeTrc">
<th class="subHead" colspan="6">Barcode Information</th>
</tr>
<tbody wicket:id="barcodeTbody" id="box217" style="page-break-before:avoid;page-break-inside:avoid;">
<tr>
<td class="label" style="width: 20%">GS1 Databar (Black & White):</td>
</tr>
</tbody>
</table>
<div>
<pb xmlns="http://www.allcolor.org/xmlns/yahp" />
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form1 noborder">
<tr wicket:id="imageTr" id="imageTrd">
<th class="subHead" colspan="4">Images</th>
</tr>
<tbody wicket:id="imageTbody" id="box218" style="page-break-before:avoid;page-break-inside:auto;">
<tr>
<td colspan="4" style="padding: 0px; border: none;">
<table width="100%" border="0" cellpadding="0" cellspacing="0"
class="form1 noborder">
<tr>
<td>
<div align="center">
<H1 align="left" class="imageHeaderCSS">Other</H1>
</div>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div wicket:id="incentivesRepView">
<pb xmlns="http://www.allcolor.org/xmlns/yahp" />
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form1 noborder">
<tr>
<th colspan="4"><div wicket:id="incentiveStatus" class="status">2-Incentive - 2 Approved</div>
</tr>
<tbody id="box212">
<tr>
<td style="padding: 0px; border: none;">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form1 noborder">
<tr wicket:id="barcodeTr" id="barcodeTr17">
<th class="subHead" colspan="6">Barcode Information</th>
</tr>
<tbody wicket:id="barcodeTbody" id="box217" style="page-break-before:avoid;page-break-inside:avoid;">
<tr>
<td class="label" style="width: 20%">GS1 Databar (Black & White):</td>
</tr>
</tbody>
</table>
<div>
<pb xmlns="http://www.allcolor.org/xmlns/yahp" />
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form1 noborder">
<tr wicket:id="imageTr" id="imageTr18">
<th class="subHead" colspan="4">Images</th>
</tr>
<tbody wicket:id="imageTbody" id="box218" style="page-break-before:avoid;page-break-inside:auto;">
<tr>
<td colspan="4" style="padding: 0px; border: none;">
<table width="100%" border="0" cellpadding="0" cellspacing="0"
class="form1 noborder">
<tr>
<td>
<div align="center">
<H1 align="left" class="imageHeaderCSS">Other</H1>
</div>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
```html
Am I doing something wrong ? Why is it that the content of second page is shown again in third page ?
It's because it seems you're nesting page break.. I would put the page break under the div (
2015-06-10 20:29 GMT+02:00 varun-prathap notifications@github.com:
Once again, thanks for your time.
I'm trying to achieve this (see picture below), [image: trying_to_achieve] https://cloud.githubusercontent.com/assets/7615049/8090536/8fbc1b4e-0f7c-11e5-9a01-996fc0568028.png
But currently I'm getting this (see picture below), [image: current_result] https://cloud.githubusercontent.com/assets/7615049/8090578/e14839b6-0f7c-11e5-90e5-69e9bfc24664.png
This is the sample snippet code for achieving the above result,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Program Information Program Description:
1-Incentive - 1 Approved
Barcode Information GS1 Databar (Black & White):
Images
Other
2-Incentive - 2 Approved
Barcode Information GS1 Databar (Black & White):
Images
Other
Am I doing something wrong ? Why is it that the content of second page is shown again in third page ? — Reply to this email directly or view it on GitHub <https://github.com/allcolor/YaHP-Converter/issues/35#issuecomment-110864812> .
All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)
Oh, I see. Unfortunately, 'div wicket:id="incentivesRepView"' is dynamically generated (the 'div' is a loop that gets repeated 'n' number of times based on business logic). Every time a new 'div' starts, it needs to be in a new page (which is the reason I included the page-break inside the 'div'). Same way, the 'img' section inside inside every 'div' needs to start on a new page as well.
So, I think I mightn't be able to realize this scenario :(
You still have the possibility of using css page break instead of yahp:pb.
Use the css styles page-break-after / page-break-before.
It might work.
Regards
2015-06-10 22:03 GMT+02:00 varun-prathap notifications@github.com:
Oh, I see. Unfortunately, 'div wicket:id="incentivesRepView"' is dynamically generated (the 'div' is a loop that gets repeated 'n' number of times based on business logic). Every time a new 'div' starts, it needs to be in a new page (which is the reason I included the page-break inside the 'div'). Same way, the 'img' section inside inside every 'div' needs to start on a new page as well.
So, I think I mightn't be able to realize this scenario :(
— Reply to this email directly or view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/35#issuecomment-110894510 .
All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)
Thank you, I've used a combination of CSS & YaHp page-break attributes/tags. Its is working fine now.
Hi,
Shown below is a code snippet (also attached a screen capture of the HTML code) where the PDF Conversion breaks. If I remove the 'yahp:pb' tag from 'div id="div2"', conversion works fine. However, the actual code has lot of dynamically generated nested divs.