I have a Ruby on Rails back-end service that takes individual PDF documents and combines them into a consolidated PDF - app uses Wicked-PDF ruby gem for generation.
When the PDF is viewed through the browser's default document viewer for PDF, the full document is visible. However, when the document is downloaded and viewed through Adobe Reader or Acrobat, only a part of the document will be fully rendered and then I receive an error "Problem reading this document (14)" with all of the remaining pages turning into small blank thumbnail-like pages, almost like it is corrupted - however, it is not corrupted because it is fully viewable in the browser.
The error has occurred on multiple documents in inconsistent locations, so it seems like it might be related to the particular document being compiled into the full PDF document, but haven't been able to isolate the cause.
Has anyone else encountered this issue w/ the Wicked-PDF package gem?
We identified that the issue was actually in the combine_pdf gem we were using to do the document compilation. The error is caused when two or more documents share the exact same content, ie. they are the same file, regardless of their file name. We are now commparing each document to all others before compilation to ensure that it will not generate an error.
Related
In my application, users can change the background image of a banner. They upload the file using Simple Form and Active Storage. It's working correctly but we had a user trying to upload a file name banner-website.png (2).png. The file is uploaded and saved but doesn't appear as a background image. I guess this happens because of special characters in the filename.
What is recommended to avoid such situations? Do we need to sanitize file names?
Several things to check:
Check the console and tried to view the CSS and see if the full link
is being populated? Try checking the CSS code and copy the link to
an address bar to see if the image loads from that direction.
Check the users png file to make sure its not corrupt. PNG headers that are corrupt can cause issues displaying in a website.
Check to see if your sanitizing plugin is causing an issue with that file. I have never used that one so regarding that I cannot say.
I tried uploading a file with a same name into my Rails 6 testbench (vanilla with active storage and stimulus js) and it works fine. It could be a conflicting CSS code too.
Just my 2 cents.
I've found the solution here: Rails Active Storage - Background Image invalid property?
Adding a single quote around the URL solved it.
I am developing Rails 4 application where used PDF:Toolkit. Everything work file like open pdf, pdf-to-text working well in local.
But when i uploaded code on server then always read any pdf blank. No any contents read inside PDF file.
PDF::Toolkit.pdftotext(#document.attachment.path,"-layout")
Output nil of every PDF using above syntax.
I tried lots but not found any issue.
Anyone have a idea.
I'm generating a markdown document using my Rails 4.2 app which includes images that are on the same server (in the public folder).
Using pandoc (pandoc-ruby 1.0.0), I want to convert the document into various formats, especially HTML (to preview it in the browser) and DOCX (to download it).
The preview in the browser works perfect. But when converting to DOCX, the images aren't included. I guess this is due to multiple requests to referenced images while pandoc is generating the document.
I have already experimented with setting allow_concurrency to true, but this didn't solve the problem. Also, it happens on both the development and the production environment (while in development, it takes a long time, and in production it doesn't - maybe due to some differences in timeout limits?).
I have already found a way to solve my problem by not referencing the images using an URL, but by embedding it as base64 string into the document. But this for sure can't be the solution of choice, as it tends to bloat up the HTML document a lot. Also, on production, I already get RuntimeError (Stack space overflow: current size 8388608 bytes) from pretty small embedded images. So I have to find a real solution.
Reference the images by file path instead of url if they are on the same server.
I'm generating PDFs in my Rails application using the Prawn PDF library. Everything is working great, but when opening the resulting PDF in Acrobat or Acrobat Reader the message below is shown:
An error exists on this page. Acrobat
may not display the page correctly.
Please contact the person who created
the PDF document to correct the
problem.
Adobe lists this as being fixed in their Acrobat 8.1.3 release notes.
1810668 Memory leak while printing
large document with images:
> When a large document is exported to a
PostScript, or sent to a printer for
printing "An error exists on this
page. Acrobat may not display the page
correctly. Please contact the person
who created the PDF document to
correct the problem" can occur. This
problem was encountered on certain
documents with a large number of
monochrome images, but has been
rectified in 8.1.3.Root: Fixes issue
found in 8.1.2.
But I'm seeing the issue in all current Versions of Acrobat Professional and Acrobat reader. My PDF does use a background image on every page, has lots of pages (usually 75+), and has lots of transparent images, but nothing that should be causing an error. Additionally Mac's Preview shows no issues, and if you press "OK" on the Acrobat error, everything is fine.
I ran the Preflight tool in Acrobat Professional to check for PDF syntax errors and found no errors but some warnings "Unbalanced q and Q operators".
This is for a customer facing application so I can't change settings to suppress the error in the PDF reader.
Any ideas on how I can get the error to go away?
As Mark noted "q" and "Q" operators must be balanced in a pdf file.
Prawn PDF library seems to have a bug. I found this in a comment of an open issue:
I made an workaround some weeks ago by
patching the prawn-library itself. The
root of this error is an "unbalanced
q/Q", which appears only in Adobe
Acrobat Pro preflight. I patched it by
adding an additional \q in the prawn
PDF-Generator.
https://github.com/sandal/prawn-layout/issues#issue/25
This was a bug in prawn, it should be fixed in the 0.11.1 release.
MOSS 2007 SP2 64 bit. Multi-server install.
How do I figure out the where to find the document library upload error I am getting?
I have document library with a custom workflow attached that will have a PDF document OCR'd during the upload. This library has some custom meta data fields from a content type that are exposed during the upload. As part of the workflow it OCR's the PDF doc and puts it back into the library and keeps it at version 1. During the upload I am getting an error for the PDF documents but it is uploading the document and the meta data fields are not getting updated with the user input. Below is the wonderful error message I get back. I have tried looking at the logs and I am not seeing anything pertaining to this error.
Go back to site
Error
The file 0746850076 Workers Compensation/a.pdf has been modified by DOMAIN\user on 14 Oct 2009 11:05:44 -0400.
Troubleshoot issues with Windows SharePoint Services.
Make sure the current user has proper rights and that you're not having an access collision with another user. Smells like a concurrency issue. Ensuring that you have proper locking in place should eliminate your woes
You probably is running into a concurrency issue; this message occurs when you do update some metadata and that document already has been modified by someone else (sometimes even you).
Before changing your metadata, try to reload your SPLIstItem/SPFile object to reflect your most actual metadata values.