Pdf.js: print rendering in Safari & Chrome - tcpdf

I am generating a PDF using TCPDF and feeding the resulting base64 stream to pdf.js for printing. The display output appears as expected, but when I preview or print the document, some unexpected scaling takes place.
In TCPDF, I am importing an existing PDF and overlaying that with data that is generated on the fly. The imported PDF in the print output is being scaled to about 25% of the page while the dynamic data appears to be scaled properly.
Display output - http://i.stack.imgur.com/PPQPt.png
Print output - http://i.stack.imgur.com/Go1Wy.png
This happens in Safari and Chrome, but in Firefox the print output is rendered correctly.
Any advice on how to get Safari and Chrome to cooperate?

Related

Microsoft Edge - Print to PDF scaling not responding

When trying to Print a website to PDF in Edge, the scaling option ( % size) don't respond. The same page and action works in Chrome.
Tried different webpages, updated to latest version, tried different print setting combinations.

How to print with custom page in ruby on rails?

Can i print a lot of same barcode image (depends on total barcode) in rails?
Example total_barcode is 6, so i print 6 same barcode.
The image will fit with the layout.
If the size of paper only fit 4 image, and it will generate another page until there are 6 image
Its looks like
XX(page 1)
XX(page 1)
XX(page 2) the x is image
Thanks i hope you guys can understand what i'm trying to say 😭
This is possible.
I would suggest first creating the barcodes page as html, and then converting to pdf.
To create the barcodes on an html page, you have to use a barcode font (Google it), you will need to load the fonts into the page, and specify the barcode font for the barcode "text" in css. When you render text with a barcode font, it appears on the page as a barcode.
Next you need to convert the html to pdf. I suggest using the same url, but appending .pdf to the url instead of .html. You can look for libraries that convert from html to pdf.
Sorry I haven't provided much detail, this is a big project!

CGContextDrawPDFPage renders white page for valid PDF

I have an issue with PDF rendering using the CGContextDrawPDFPage function. I develop an iPad app (targeting iOS 7) that does very specific things with PDF, and I cannot use UIWebView so please don't suggest it. One of our customers reports a white page being rendered while every other PDF viewer renders the PDF just fine.
To make sure I don't have any dumb errors in my own code, I have taken Apple's ZoomingPDFViewer (https://developer.apple.com/library/ios/samplecode/ZoomingPDFViewer/Introduction/Intro.html), replaced the PDF they ship with the one from our customer, and started it: indeed a white page is being rendered in stead of the proper contents (a scan from a building blueprint.)
I am 100% certain is the not the loading, viewing or rendering code in the ZoomingPDFViewer example from Apple, because every other PDF file I try to view with the example renders just fine!
I'm trying to obtain permission to upload the PDF here, but I don't have it yet, so my question is: without access to the PDF that's being rendered wrongly, has anyone any idea on what this might be? Are there any limits in the PDF renderer that might cause a white page to be rendered?
Thanks in advance!
edit: The PDF is rendered perfectly in every other PDF viewer, including but not limited to the iPad email application (!), Safari on Mac OS X, Preview on Mac OS X, Acrobat Reader on Windows, FoxIt reader on Windows.
edit: converting the original PDF file (which was a pdf 1.3) to a pdf 1.5 using ghostscript on Linux solved the issue: the PDF is now properly displayed! I used the following commandline:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dNOPAUSE -dQUIET -dBATCH -sOutputFile="filename.pdf" "filename.pdf"
The iOS pdf rendering engine does not support JPEG2000 images. If your scanned image is such an image then it will not be displayed.

Printing SVG from Browser (IE and FF)

I have a project that generated a svg representation of a tree and saves it as a svg.
I tryed to print the resulted svg file from the browser (any browser) but it prints only the upper left corner that fitts the screen. The rest is clipped.
I tryed embedding it on a html, I tryed giving fixed dimensions to the svg file, but the problem persists.
I searched this topic intensivley but no one seems to have this problem.
Thanks

Why Safari on iPad doesn't show large jpeg enclosed in IMG tag?

Last time I saw someone asks why Safari on iPad doesn't show some 1920x1440 jpeg with real size & I solved that puzzle. You have to use a progressive-encoded jpeg. However, I find another different problem.
Say, demo.jpg is a progressive-encoded jpeg with 2000x3000 & I upload it to my website. I then access it via url ...demo.jpg, Safari will show it with 2000x3000 size, perfect.
Now I make a most-simple html file named mypic.html. This html has only img tag with src=demo.jpg or src=demo.jpg width=2000 height=3000 inside body. Now I access it via url ...mypic.html. This time Safari show a very small icon of a question mark?
Does anybody know why the latter case fail?
The problem is about the memory available to Safari. The total amount of RAM is just 256MB, and Safari stops showing the image of much smaller size. You need to scale them down.

Resources