Create PDF layers using DomPDF - pdf

I'm trying to create a PDF with layers, one for the texts and the other for a background image so user can print only the text layer.
Does anyone knows if it's possible and if so, how can I do that ?
I'm using version 0.8.2.
Thanks

Finally it looks like layers or the Optional Content Groups are not supported by DomPDF. So my solution was to change to TCPDF, it's not great for CSS but it offers the option to create layers and change the visibility of objects in the PDF.
So you can set objects to show only in screen or print.
I hope this can help if someone has the same issue.
Here's the link to TCPDF

Related

Is it possible to convert fabricjs svg output to pdf without rasterizing?

We are building a web app where the user can make a design by using fabric.js and at the end he should receive a pdf file with his work.
At first, we tried to use JSPDF because it was prefered to have a cliente-side solution. However by doing pdf.addImage(canvas.toDataURL(),...) we are rasterizing the design.
In second place, we tried server side solution using WKHTMLTOPDF, sending canvas.toSVG(), but there are some issues with fonts and shapes rendering.
The designs are complex as they can have text, shapes, images and svg.
We also tried INKSCAPE (inkscape --without-gui --export-pdf ...), MPDF and MUPDF without good results. IMAGEMAGICK is not a solution has it also rasterize the design.
The main goal is to get a vector pdf, where it's possible to increase size and where the elements of the design are selectable, and if possible that pdf should be ready to print (300 dpi and cmyk)
Yes its possible using TCPDF library.
Please check this ImageSVG api for more information for converting SVG to PDF.
https://tcpdf.org/examples/example_058/
Export the canvas to svg and use pdflib to make the pdf.
You can find an exemple here:https://www.pdflib.com/pdflib-cookbook/graphics/starter-svg/

XSL-FO display watermark only when printed

Using XSL-FO, is it possible to add a watermark to a document that is visible only when it is printed?
MY XSL-FO output format is PDF.
I suspect that the answer is no, but I would love to hear different.
AH Formatter from Antenna House can produce PDF with print-only layers as you describe. See http://www.antennahouse.com/product/ahf60/docs/ahf-ext.html#pdf-layer
You could put the print-only watermark in one of the side regions and use axf:layer to make it appear on a layer that you have set up to be print-only.
There is a free renderer named altsoft xml2pdf that supports layers, see https://www.alt-soft.com/tutorial/xslfo_tutorial/xsl-fo_extensions_pdf-layer.html
I use this renderer for regular production since years, but its windows only.

Printing a Vaadin Layout

I want to print a Vaadin layout and all of its components (text, tables, html, charts, etc), sending it to a pdf preview, hopefully getting exactly what I see in the screen (for that specific layout)
thanks!!!
The solution, seems to me, that is not something Vaadin is able to provide. You have to extract the html specific to you desired layout and, along with the styling, delegate to a tool that might convert it properly to a PDF, like jsPDF, but you need to integrate it into your Vaadin application.
If you're interested I can try to write some code that will help you. If so, let me know.

Printing labels on vector layers by geoserver print module (MapFish)

I use MapFish plugin for geoserver. Vector layers are printed fine but text labels on them do not appear in pdf. Although they are visible on the map before printing.
Help me please =)
Please, use latest mapfish-print. You need to download and compile it as described here https://github.com/mapfish/mapfish-print

Text reading experience in iOS app

I want to implement a great text reading experience in my app, similar to "Pocket", that would look a lot like this:
Basically, I'd like to have control over the text font size and font family while loading local HTML files in a UIWebView.
Could anyone point me to the right direction? Are there any frameworks or libraries out there that provide the base for such experience?
Thanks in advance.
A simple answer is: don't. Instead load it into a UITextView. You can easily change the font size with it, as on HTML you would have to modify the file instead of calling 1 line of code.