I am using prawn pdf in Rails 3.
I try to embed an image into my pdf file using
image "#{Rails.root}/app/assets/images/logo.png", :height => 30
The resulting PDF consists of the logo, which is good. However there is this line:
#<Prawn::Images::PNG:0x007ff7d1438f20>
printed below the logo.
There is nothing special with my code, I am just following this Railscast to set things up:
http://railscasts.com/episodes/153-pdfs-with-prawn
and added the image code.
May I ask if anyone faces the same problem and how to resolve it?
Thank you so much!
Related
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!
I'm trying to work out how to upload in image using and display it in my PDF.
In the image below you can see the data that I get when passing it down to the PDF-component I've made.
Image data passed to jsPDF component
I've tried the doc.addImage(image, "png", ...) method, but I believe this is supposed to work with urls.
Any help is greatly appreciated!
I have tried to open image files in my jupyter notebook using
![description](image_source) markdown code.
But the problem with the above approach is that the image I tried to open is too big and the other problem is, if the image that I am trying to open is of high resolution then that image is not opening at all.
Please tell me if there are any attributes for this markdown code to shrink the image size.
Thanks in advance...
Because the markdown in Jupyter notebooks can handle several HTML tags directly, you can use the third option shown here to display images in Jupyter notebooks. It is more succinctly spelled out here.
<img src="path/to/image1" width="45%"/>
<img src="path/to/image2" width="200"/>
Alternatively you can use use the style CSS property within the <img> tag like illustrated here under the section 'HTML / CSS Codes to Tile Images' and here under 'Responsive Images' to control the dimensions in the markdown.
I'm using Paperclip 4.1.1 for images uploading. I store three sizes, original, medium and thumbnail. When I try to show the original images, some of them appear rotated to the left, and it happens randomly, because some others are displayed correctly. This does not happen with medium and thumbnail sizes. The funny fact is that if I open any original image url on a browser, it always displays correctly. Any thoughts?
EDIT:
According to this comment in the Paperclip Railscast, this behavior doesn't occur on processed images. As a workaround, I added a new Paperclip style big enough to meet my requirements.
Check this How to set Paperclip to process original image? this will help.
Adding original: {convert_options: '-strip'} in styles help
Is there anyway to generate a thumbnail image for the first page of an uploaded PDF file. I want to display this image along with the description (provided by the user) of the file.
The first answer from this question looks like it'll do what you want.
You can use an image processing library like ImageMagick to convert a PDF into an image.
Call out to the system with something like:
system("convert -size 150x150 /path/to/uploaded/document.pdf /path/to/thumbnail/file.png")