Questions tagged [prawn]
Prawn is a fast, nimble Ruby library for creating PDF files.
699
questions
0
votes
0
answers
19
views
Rails / Prawn Image From Active Storage Color modified
I'm looking for your help regarding an issue i have with on Rails with Prawn(Gem for PDF) when adding an image from Active Storage. When using the image on the app there is no issue but when i add the ...
0
votes
1
answer
29
views
Difficulty transferring prawn pdf image to frontend
I am streaming a prawn PDF to the frontend of my application, but it shows the image as 100% black. The image is a gif file that I convert to png using rmagick. If I save the pdf file on the backend,...
0
votes
1
answer
205
views
Insert QR code into PDF using gem receipts in Ruby on Rails
I'm using gem 'receipts' by Chris Oliver, and I want to insert QRcode with payment details (to the footer section for example).
Models: Partner and Charge.
I want QR code to contain model attributes, ...
1
vote
0
answers
118
views
Ruby on Rails - How to convert to images some elements from a word document
Context
In our platform we allow users to upload word documents, those documents are stored in google drive and then dowloaded again to our platform in HTML format to create a section where the users ...
0
votes
0
answers
128
views
Rails PDF generation in model
I am writing and invoicing application in Ruby On Rails, which is supposed to generate a PDF from a model so called out_invoice to an in_invoice under certain conditions.
The PDF for the out_invoice ...
0
votes
1
answer
120
views
Prawn Html text and image not same line
I am using prawn and prawn html, when I using PrawnHtml.append_html(pdf, '<p style="display:inline;"><img height="26" width="26" src="path_image" >...
0
votes
1
answer
104
views
Validate PDF is stampable - Rails, Prawn, CombinePDF
I'm working at a company where we upload a good amount of PDFs, which we later stamp using Prawn. Occasionally these PDFs upload and save fine, but when we try to stamp them later they don't work and ...
0
votes
1
answer
91
views
Is there a way to generate a pdf file with editable text (comments or markups) using Prawn libaray in Ruby that can be modified later?
I have been using Prawnpdf in Ruby to generate pdf documents. The only issue that I have is that I cannot modify the rendered text in the pdf file afterwards (using Bluebeam or Adobe Acrobot Pro). Is ...
1
vote
1
answer
210
views
#<NoMethodError: undefined method `table' for #<PdfMethods:0x0000023fc7b70648>>
I have been trying to create a table in a pdf i am generating using Prawn gem in rails. I have been following some tutorial but when I try adding the table to the pdf I am getting the error '#<...
1
vote
0
answers
133
views
Prawn: is there any way for text justify alignment of all content in bounding_box?
I have an arbitrary text write for user
customer_note
and I'd like to align the text randomly in a text align justify, I have tried to access the text but there is no way to justify the text.
if ...
1
vote
0
answers
138
views
How to get the final position of a text to position a new one in Prawn
I have two user typed refereed texts that are placed one below the other and I'm using prawn gem to generate pdf and I position my code as follows:
# show.pdf.prawn
...
pdf_notes_1 = firt_text # ...
0
votes
0
answers
40
views
(nil can't be coerced into Integer) getting this error when using prawn gem
@@pdf = Prawn::Document.new
summary='s2_summary'
@@pdf.text summary.to_s, :align => :left
@@pdf.text "Dsh Days Breakdown", :align => :center
when running the code " @@pdf.text ...
0
votes
1
answer
1k
views
Convert html to pdf using prawn in ruby on rails
I am working on a Rails project and I need to convert the HTML page to a PDF page but it's writing HTML as it is on a pdf page. PDF page is not showing like a webpage. How can I generate a proper PDF ...
0
votes
0
answers
222
views
PDF Prawn: opening a link in a new tab
I'm trying to open the following link, that is created in a PDF (which is automatically opened in a browser), in a separate tab - I am using Prawn PDF.
pdf.formatted_text_box [{
text: t('link'),
...
2
votes
0
answers
325
views
How to display application/pdf response from Rails API to Nuxt frontend
I'm using Nuxt and Rails to generate PDF.
Chose prawn gem for PDF, and when send proper params, PDF was generates as I intended.
When I use this API from Nuxt throw axios, I want to display ...
0
votes
1
answer
110
views
I cant draw and format prawn text properly
Can you help me??
I need to draw one line text in prawn pdf with responsible text size which depends on text characters count...
Less chacters count -> bigger text size.
bounding_box([...
0
votes
1
answer
237
views
Trying to make a two column unordered, bulleted list with Prawn PDF in ruby/rails?
I am having trouble with how to create a two-column bulleted list using prawn PDF and prawn/table. I wanted to know if there is a way to do it that's not too custom/uses existing classes to take care ...
1
vote
0
answers
199
views
Error installing prawn-gmagick within Heroku stack 20 due to invalid wand/magick_wand.h path
Here is the error I'm getting when trying to deploy to Heroku using the most recent stack (20)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/tmp/...
1
vote
1
answer
993
views
rails 6.1: cannot load such file -- prawn-table
I am using the prawn gem to create pdf's. So, to create tables requires using the separate prawn-table gem.
For some reason, I am unable to require the prawn table gem and have no clues as to why.
The ...
0
votes
1
answer
222
views
Hexapdf: trying to draw white box, but its not appearing
When I run my code, my white box does not appear. I need a white box to cover existing images, text, so I can add new text. If I change the color to background_color: [255,255,180], the box is a ...
1
vote
1
answer
873
views
How to use CombinePDF with Rails 6 (ActiveStorage) on heroku
I generate PDF documents using Prawn in Rails. For years I have only inserted jpg's into PDFs. More recently I've had a need to insert an external PDF into a Prawn PDF. The way to do this seems to ...
0
votes
1
answer
135
views
Can't See Info (Metadata) in Prawn Generated PDF's
I am using the prawn Ruby gem to generate PDF files in my application. I would like to insert some metadata in the PDF and have done as specified in the docs:
private def prawn_create_document(...
2
votes
0
answers
456
views
Bad image quality with CarrierWave
I want to create the ability for the user to upload an image into a pdf which will be generated inside of the app. To do so I'm using gem prawn to pdf creation and CarrierWave::MiniMagic to create ...
0
votes
2
answers
202
views
How to put an image on a label using Prawn/labels?
I'm using Ruby for scripting, and Prawn-labels to print ISBN labels for books, using Barby to generate the EAN-13 bar codes.
The ISBNs come out of MySQL. That works fine. I can create a PDF of 30-up ...
0
votes
1
answer
15
views
Build content block in Prawn?
This seems to be easy but I can't find a solution. I have a table like this:
table([["cell 1","cell 2","cell 3" ]]
I want to do something like this:
content = block do
...
0
votes
1
answer
325
views
Prawn the horizontal line from the left border/edge in PDF
I use gem prawn to generate pdf file. I want to have horizontal line 105 mm from top, 1pt line, #000. I've set left margin and top margin (I need it in the rest of the pdf) as follow:
LEFT_MARGIN = 25....
0
votes
1
answer
116
views
Rails gem prawn - undefined method `[]' for Float in horizontal line with a specific location
I'm using Prawn gem to generate the PDF file (A4 format). I want to have two horizontal lines/folding marks which should be available: 105 mm from top of the document, 1pt line, #000. From what I know ...
1
vote
2
answers
432
views
Adding image to PDF in Prawn using image data
So I have an image that's being saved in a database that I need to show on my Prawn Pdf, but when I pull the image, decode it, and try to display it on the Prawn PDF, I keep getting the issue where it ...
1
vote
1
answer
675
views
Prawn PDF change font size and line height from html_text
In my Rails 6 app with Ruby 2.7 I'm using gem prawn to generate a pdf file. So far everything has been rather straight forward. I'm having a problem defining line height in html_text. Like in a method ...
2
votes
1
answer
465
views
Insert rounded rectangle into a Prawn table cell ruby
I am trying to recreate this in Prawn but could not get the rounded rectangles inside the table cell.
I have used Prawn table and here is my code -
tabledata = [["City", "Count" ],...
-1
votes
1
answer
722
views
Prawn set cell color under a condition while making a table
I'm trying to generate a table while changing the background color of a cell under a condition. I've resorted coming to here for help. Here's an example of what I'm trying to do:
idx = 0
...
1
vote
1
answer
999
views
How to compress a pdf uploaded by a user in rails using Prawn Gem [closed]
I am new in rails and also in programming. I am trying to compress pdf using Prawn gem but I am not sure if it's the right gem to use or is there is another tool. A user is able to upload a pdf, but ...
0
votes
1
answer
488
views
How to encrypt csv/xlsx file in Rails
I am want to implement password protection to my csv/xlsx file, but somehow not able to. I am not able to find something written well over the internet. I tried this with xlsx.
render formats: :xlsx ...
0
votes
2
answers
309
views
I'm creating a PDF in Prawn and I'm trying to use :absolute_top_left and :absolute_top_right but they both send it to the top left
This is what I have so far
Prawn::Document.generate(location) do |pdf|
pdf.text location1, :absolute_top_left => true
pdf.text location2, :absolute_top_left => true
pdf.text location3,...
0
votes
1
answer
142
views
How to get rid of weird box characters in PDFs generated with Prawn?
I am running a Rails 6 app where users can convert their contents into PDFs.
I am using Prawn to generate the PDFs.
Most PDFs look fine but some of them contain empty (?) box characters. I simply don'...
2
votes
1
answer
769
views
Prawn PDF: change Prawn::Document object's margin
The first page of my PDF is a full width/height image, so I've set margin: 0 while generating my Document
Prawn::Document.generate(FILENAME, margin: 0) do |pdf|
...
end
Though I'd like the rest of ...
0
votes
1
answer
111
views
Is there an upgrade gem to prawn to covert odf (.odt)?
I've been using the awesome prawn gem in my last few project, but this time I have to covert a odt file (in odf format) to PDF.
I know that there are many gems that can do this, for example docsplit ...
-1
votes
1
answer
945
views
Fill PDF form with data and images
My goal is to fill the existing PDF interactive form with user data.
Requirements for this are:
it should be able to insert data into text fields;
it should be able to insert an image on the XY ...
0
votes
0
answers
204
views
How to give padding to child table in Prawn PDF?
I have generated a nested table using Prawn but it occupies the whole space of the parent table so it is becoming difficult for users to identify which is a child.
Is there any way where we can give ...
0
votes
2
answers
1k
views
Create pdf file from multiple models in rails app
In my rails app the user inputs a lot of data in different models. The user should have the possibility to create a pdf file from all the data he inputted in the different models. Which ruby gem does ...
0
votes
0
answers
176
views
Rails Prawn randomly generates corrupt PDF files
I'm having an issue with the Rails prawn gem. It happens very rarely and seems to be completely random. When it does happen, the PDF that is generated has all garbled text. There's no error message or ...
1
vote
1
answer
348
views
write text combine two language Arabic and English in prawn rails
i need write text combine two language for example
use require 'arabic-letter-connector'
text_direction :rtl # ltr
long_text = " Algorithm & Data Structure مرحبا يا العالم"
text ...
0
votes
1
answer
267
views
Using link_annotation with :Desc option in Prawn PDF
I have been struggling to link a text heading with a specific page in the Pdf, similar to the linking of Table of Contents in the Pdf file. I have found link_annotation method to achieve this however ...
0
votes
0
answers
147
views
What is the best way to render a template inside a Rails model?
I would like to generate a PDF from a model, using the Prawn gem. Below is my solution, but it calls ActionController::Base.new() from inside the model.
Currently, the below code works. Is there a ...
0
votes
1
answer
1k
views
Why is my PDF's Acroform checkbox annotation not rendering in Acrobat Reader?
I'm working on some code that generates PDF documents. I'm working on generating Acroform checkbox annotations for editable PDF forms, and these render perfectly fine in most of the PDF readers that I'...
0
votes
2
answers
465
views
Spider Chart (High Chart) in rails with Prawn PDF How to generate?
I want to implement a spider chart (High chart) in my rails application inside pdf for PDF I've used Prawn PDF gem. So anyone has any idea about implementing a spider chart in pdf. I also have a ...
0
votes
1
answer
1k
views
What's the best way to download a ZIP file with a large amount of dynamically generated PDFs?
In my Rails app a user can create up to 3000 invoices per month. For each invoice s/he can generate an invoice PDF as well. This happens on the fly, i.e. the PDFs never get saved anywhere on the ...
5
votes
1
answer
942
views
Embedded Font Error for Rails Prawn Document
Just last week this was working fine and now my PDF documents are giving me this "Cannot extract the embedded font '1491bd-SourceHanSans-Normal'. Some Characters may not display correctly." error.
...
0
votes
1
answer
27
views
How to interrupt new page insertion using column_boxes in Prawn
I override #start_new_page in my Prawn class with some logic that adds borders to the page as the last thing during page creation. I am now adding some pages that use #column_boxes. Unfortunately, ...
1
vote
0
answers
35
views
Prawn syntax into a model
I would like to switch my pdf generation form the controller to the model. But I am not very comfortable with the syntax.
My controller (is working) :
def generate_pdf
value_1 = 1
value_2 = 2
...