How to avoid adding renditions for pdf uploading into DAM? - java

When I upload pdf file to cq5 I see following structure in my crx:
This structure looks strange for me. I don't understand why do I see png renditions here.
How can I use these renditions?
My current vision that these renditions couldn't be helpful. Thus I want to achieve that after uploading PDF files into DAM these renditions doesn't generate.
Can you provide steps for this?
after my changes in workflow:
before my changes:
update 2
I set dimensions follows:
but I see old result after pdf and jpg uploading

The purpose of these renditions is, as per their name, that they can be used to display thumbnails of the documents — e.g. you may want to display the front cover of each PDF if in a gallery section.
The thumbnail is created by the "DAM Update Asset" workflow (http://www.example.com/etc/workflow/models/dam/update_asset.html; until v5.6) in its Thumbnail creation step — I'm not sure that you can configure this to skip certain file types.
To get around this, you could remove this step and replace it with an Create Web Enabled Image step — this will allow you to specify MIME-types to skip over in its arguments panel:
Alternatively, you could write a bespoke Process class which would use ImageMagick to generate thumbnails but ignoring PDFs.

Related

Using qoppa to create pdf with table structure just like we do using itext pdf library

Sample pdf
A sample pdf is shown in image. We need to create 2 column structure which can have text/images/figures etc. Moreover, we need to change the text format like font/size, auto wrapping etc. Text content will be dynamic as we don't know the content at compile time hence, it should be able to align itself after paragraph ends and we should not need to provide hard coded value for height. Giving absolute positions of components in qoppa to create pdf is not feasible for us because of dynamic content.
We've already explored qoppa library and we couldn't figure out how to make a pdf like shown in image. If anyone has worked on qoppa, Please do share the valuable resources available online related to qoppa. And Please, let me know if it is possible to create a pdf like this using qoppa.

Lazy Loading PDF

I would like to implement lazy loading PDFs. Going through the forums we need to make make the PDF documents as 'linearized' and It will load first few pages quickly because it store page references in the start of the file. Will this resolve below problem as well.
There is separate charge for data transfer in AWS. Users want to see only first pages, But our system has to download entire PDF document that may be huge file. So we have to pay more money. If linearized PDF solves how to implement in Java technoglogy while download
The way a linearized PDF is processed by a PDF reader is implementation dependent, but I dare to say that in all cases, it is very likely that the reader will just continue to download the rest of the file in the background after showing the first page. The goal of linearization is not to prevent the rest of the file from being downloaded.
An alternative could be for you to split the file in sections and provide bookmarks that point to external PDF documents that will allow navigating through all the sections.

Preview LaTeX output with Java

Right now I'm working on displaying LaTeX generated document with Java.
Strictly speaking, LaTeX source can be used to directly generate two formats:
DVI using latex, the first one to be supported;
PDF using pdflatex, more recent.
However rendering dvi or pdf is not available as far as I know.
Is there any way to handle those formats ? Or maybe others that makes sense ?
There are not enough details with regards to how you wish to "render" DVI or PDF from a LaTeX document. However, you could always just render the pdf using pdflatex and DVI using latex and use ICEpdf for viewing PDFs and javaDVI for viewing DVIs.
Another neat hack to display pdf in a panel is to pass the file path to an embedded web component in the application, and the web component will use whatever pdf rendering tool is available on your machine (Acrobat, Foxit, Preview, etc.)
I remember there was a post about this a long time ago.
I don't think there's a generic way to preview the rendered output without generating the file itself. You can write your own LaTeX engine which caches the output every few seconds and displays that but regardless of the storage, you have to output it somewhere physically and then render the output separately using any of the steps mentioned above.
Another approach is to convert the div output to an svg image file and render that with SVGGraphics2D. That will produce nice scalable results. Dvi files can be converted to svg on the command line (or in a script) using:
dvisvgm --no-fonts input.dvi -o output.svg
For more conversion options see this thread on how to convert pdf to clean svg.

Custom PDF creation - Large images

Looking for a Java based PDF creation library. We're currently using Apache Velocity with HTML to render PDFs on the fly.
We'd like to be able to find a way to render large images (sometimes as big as 3000 x 1700) in a creative manner within the PDF container. For instance, a scrollable image pane within a PDF. This might not be possible within a PDF, I might be wrong.
Open source would ideal.
For a good PDF library you should take a look at iText: http://itextpdf.com/
I have used images of around 5000x4000 with iText without any problems.
I don't know if it is possible to create a working scrollpane inside a PDF, unless of course you were doing it through a custom PDF creator/viewer.
iText is open source but make sure to check out the AGPL license before you use it commecrially: http://itextpdf.com/terms-of-use/agpl.php
For just creating PDF files from images iText is a little overdimensioned. Give xsPDF a chance, it has no limits for images sizes and seems to be appropriate for your problem.
Just a FYI for anyone that may run into this in the future:
I used a library called PDFBox (http://pdfbox.apache.org/) to open a pre-existing PDF and modify the PDF with a custom sized PDFRectangle with the dimensions of the image. Then inserted the image and rectangle into that new page and got the desired results.
I didn't realize you could have multiple page sizes in a single PDF.

which Java / Groovy library to overlay text on an image

I am working on a web application (using Grails) which will generate a gift certificate. I'm thinking of a workflow like this:
The user will pick a template which will be stored as an image.
Then the text (name, date, amount etc) will be overlaid on the image to make the final certificate. There is a set of co-ordinates associated with each template which describes where to put each bit of text.
There is a kind of 'live preview' in the browser which shows the user what the final certificate will look like.
When the user is happy with the results, they download the certificate as a PDF and print it.
Can anyone recommend a library for Java (or Groovy) that will make it easy to do this? I'm not particularly worried about speed, as I suspect that the webapp will only be used by a few people at a time.
UPDATE: in the end I used the iText PDF library to overlay text on a PDF template using PDFStamper.
You can do this with the standard Java 2D graphics libraries - create a BufferedImage from the image, get its Graphics and use drawString() to put the text on top. Of course, the text would then be part of the bitmap in the resulting PDF, and not use the full printing resolution.
In addition to the answers above, I have come across the groovy library GraphicsBuilder and the Grails plugin j2D which are also potiential solutions.
You might consider using Batik to do this as SVG. Your image would be an <img> tag and your text would be one or more <text> tags. There's a converter (called FOP, I believe) which will get you PDF output.

Categories

Resources