KendoReact PDF Generator Export Issue - kendo-ui

I am using KendoReact PDF Generator to generate PDF files from HTML (client side). since it is working fine on development machine (linux), after moving same to other environment like SIT, QA etc (Linux), the tables exported as pdf behaves unusual and some texts goes little out from table's tds then breaks. also some underline issues can be seen in below image.
Kendu react ui pdf geneartion: https://www.telerik.com/kendo-react-ui/components/pdfprocessing/
Can somebody help me to resolve the issue.
I am using following following config to generate PDF:
savePDF(element, {
paperSize: "A4",
scale:0.7,
margin: 0,
fileName: newFileName,
});

Related

The model and its texture are not loaded properly inside Forge viewer

I am trying to load a custom model with a texture into Forge Autodesk viewer, using the function loadModel(), that I found here.
The other day, the model was loading, but without its texture, and no error appeared...
As usual, strange things happened during the night, and today, the model does not even appear in the viewer. This time, I get the following error :
Uncaught TypeError: Cannot read property 'proteinType' of undefined
At first, my model was a zip folder, containing an .obj, a .mtl and a .png (for the texture). I translated it into svf using Forge extractor.
So I am using, locally, in a 'Resources/3Dmodel' folder, ths resulting svf folder. It contains the .tif.png texture, the .svf file, a Materials.json.gz archive and other usual files in a svf folder (properties, camera definitions...).
There is no ProteinMaterials.json.gz archive.
So I can suppose the issue may come from the Materials.json file... I opened it, but I don't see anthing unusual inside...
So if anyone has an idea...
EDIT !
I had written in my code :
window.NOP_VIEWER.loadModel(svfPath_test, options), (myobj) => {
myobj.id = id;
myobj.name=name;
myobj.path=svfPath_test;
})
and nothing was loading.
After writing only this :
window.NOP_VIEWER.loadModel(svfPath_test, options)
the object appears, but completely gray, the texture is still not applied... and now I have this new error :
Texture load error 404 (NotFound)
It does not find the texture in the folder, but IT IS in the folder, with the right name ! So : I am starting to wonder if the image really is on the server... or not. I don't know how to check this or insert the image in the server.
Keep in mind that there is Autodesk Forge Viewer Usage Limitations Disclaimer stating that "The Autodesk Forge viewer can only be used to view files generated by Autodesk Forge services. The Autodesk Forge Viewer JavaScript must be delivered from an Autodesk hosted URL".
Nevertheless, from engineering perspective, the reasons of your troubles could vary. Could be the version of the viewer you use is not compatible with translation viewer.
From what I remember, the Forge extractor sample creates self contained (locally downloaded all dependencies) project, but for conversion it uses the Forge servers.
There might me a "misalignment" between version of the Model Derivative API and the version of Forge Viewer you use.
I would suggest, to convert your model using the official way, serve your model from the server and put it into a created from scratch basic Viewer.
Then gradually add/replace/integrate/"migrate" to the "airplane mode"
and identify at which step it breaks your model.
Or just change the locally served viewer3D.js, three.js and style.css to remote src and you can even try to play with Viewer version you use in your project by changing/adding the versioning. For example the lates one is:
<script src="https://developer.api.autodesk.com/derivativeservice/v2/viewers/viewer3D.min.js?v=v4.1"></script>
Now, if I put back the legal hat, be careful with legal aspect of your use-case.

html to pdf including MathJax transformation

How do I create a pdf with html (DOM) content accounting for the css styles of html?
HTML has MathJax javascript rendered formulae in it. I would like the pdf to show the formulae as they are visible in browser using MathJax.
Also, HTML contains few images.
Which open source java library helps to create such a pdf from html content?
I looked into Apache PdfBox but did not find a solution.
Solution has to be open source library to be used in commercial application.
EDIT
DOM content is dynamic generated on server side and not pushed to browser.
FlyingSaucer is close to what I need. However this does not support java script i.e html with MathJax can not be (properly) converted to pdf.
There are various PDF renderers based on WebKit that support JavaScript. The best I've found is the screen capture feature of PhantomJS.
http://phantomjs.org/screen-capture.html
You'll have to write a bit of code though, and make sure you don't take the screen grab until the JS has finished doing its thing.
Update
Here's a really simple example that reads HTML from stdin and saves a PDF file to disk:
// render.js
var page = new WebPage();
page.content = require("system").stdin.read();
setTimeout( function(){
page.render( 'export.pdf' );
phantom.exit(0);
}, 100 ); // <- wait for JS
You can execute this from whatever server-side runtime you're using, as long as it can execute a shell. To test it from the command line with a static file, you can do:
~/bin/phantomjs render.js < sample.html

Cannot extract the embedded font - Code Igniter and dompdf

Following the instruction in this link ( https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf ), I always encounter an error when opening the pdf file created. The error message is:"Cannot extract embedded font 'TradeGothicLT-CondEighteen'.Some characters may not display or print correctly. " and when i click OK, the pdf displays black background and when i start highlighting the body, it captures the text but text are in black font-color. what should I do to get rid of this error?
There may be something wrong with your font cache, located at dompdf/lib/fonts/dompdf_font_family_cache.php (though the exact file name depends on your release and whether you have loaded fonts). This file tells dompdf what fonts are available for use in the PDF. If this file references a font that isn't actually available you can run into major issues on viewing. You may need to re-load your font files. Take a look at the Unicode how-to for an overview of using embedded fonts. This document hasn't been updated to reflect changes implemented in dompdf 0.6.0 beta 3, but the information is still pertinent.

Why are images not showing up with Carbon's HTML rendering library

I have an old program that shows an embedded browser using the HTML Rendering library from Carbon. I am migrating it from codewarrior to Xcode, using the 10.4 SDK. While the HTML is displayed correctly, including links, the images just don't show up. I can see the alt content, and dimensions are properly set with the width and height fields.
I am doing the initialization with:
OSErr err = HRNewReference(m_HRRef, kHRRendererHTML32Type,
GetWindowPort((WindowRef) m_pWindow));
And then I open my local HTML file with:
err = HRGoToFSRef(m_HRRef, &f, false, false);
My images are also stored locally but just do not appear, it was working fine previously on my ppc-only codewarrior compilation.
I tried with web pages on Internet with HRGoToURL, and I tried replacing my pictures src fields with http:// or file:// links to images, in jpg, gif and png, always with the same result.
Are you aware of any issue like this? I know I could, and probably should, migrate to WebKit but that would me more involved.
Sylvain
This is a shot in the dark (I am completely unfamiliar with HTMLRenderingLib), but it reminds me of this. Maybe here too it doesn't load images, even local ones, asynchronously; have you tried letting the run loop loop (whichever way is most appropriate to your app: WaitNextEvent, return back to the main runloop, spin a sub event loop, …) and see if the images load?

How do you reliably render Khmer (Indic) fonts on the web (and in PDFs)?

I've been having a world of trouble getting Khmer fonts (an Indic script of Cambodia) to render reliably on the web across platforms (Mac, Windows, Linux).
Google web fonts recently added Khmer, which seems like the best bet. However, I have not been successful getting Khmer fonts to work on any Mac or Linux system. I can get them to work on Windows by installing the Khmer Unicode installer from http://khmeros.info but not by just including Google's font in an HTML file.
For example, see this screenshot of the Google web fonts page on a fresh Windows installation. You can see that the default Windows Khmer font (uuuuugly!) is being used instead of Danh's pretty fonts.
I have another test file here: http://dl.dropbox.com/u/634/khmer_test.html. For the first test, you should see something like this for both the web font and the default system font (assuming you have Hanuman installed). I have yet to find a system where both examples work reliably.
Any help would be greatly appreciated. My primary goal is to get this working on a website; a secondary goal is to get Khmer (and other Indic fonts) working in a PDF generator like iText (although I am aware iText itself does not support Indic fonts -- I'm hoping something similar does).
Every Cambodian Windows users are always delete the font name called: KhmerMool and Khmer Kampot. Then they change the default Khmer font in regedit too. You can check at http://thelifeandwork.blogspot.com/2010/01/changing-default-khmer-font-in-windows.html . I'm not sure about Khmer font and other Indic font in PDF. I always have problem when i copy Khmer unicode from PDF to put in OpenOffice or Office Word or LibreOffice.
Khmer Unicode displays on the web, it will always solve now by Google Webfont, please refer to that.
And if you want to have Khmer display in PDF by converting using iText, you can see following post:
Khmer Unicode in iText
http://ask.osify.com/qa/287
They are currently not yet support the display yet.
But, just today I can get it works by modifying the source code of iText (5.5.4-SNAPSHOT) as I just stated in my post: http://ask.osify.com/qa/613, not yet be able to publish since it's just start in testing around.
Updated 13/01/2016
I have added the source code sample for the rendering: http://ask.osify.com/qa/613
The rendering customization with iText for Khmer Unicode added in github: https://github.com/Seuksa/iTextKhmer

Resources