pdf importer with maroto - go

I am trying to develop a pdf generator. The pdf generator has multiple page. First page has some specific value with is working fine. But the second page has invoice which user uploads, In this case the user can upload a image file or pdf file.
For this I am using maroto library which works great when it comes to image or content generation but there is no support for import another pdf and merge with current one.
Now i know maroto uses gofpdf library and gofpdf has pdi importer so in my mind it should be possible to implement such feature. I didn't get any reply from their git issue board so asking it here.
Can anyone help me with this?? or my only choice is to change the library and do the coding again?

I could not find a solution for this. So i had to improvise the system
the way I solved the problem is:
generate a pdf using marotopdf library
load the second pdf
use unidoc library and merge 2 pdfs (its just merging 2 pdfs 1 after another)
This is not solving my problem 100% as i would like to have the ability to add company logo on the second pdf which is not editable atm. But its dining the main work (merge 2 pdf).

I've created a simple library to help you with this. It adds two methods to the gofpdf Fpdf class:
importPdf imports a PDF into the current PDF document
linkPdf creates a hyperlink to a PDF document
It uses cgo to use the pdsys, pdflib and pdflib_pllibraries.
You can find it here: https://github.com/jung-kurt/gofpdf

Related

Broken image after exporting Datastudio into pdf

We are using a combination of supermetrics, google sheets and datastudio for reporting social media content results. Supermetrics provide us with "Post image URL", for example this one: imageURL. The next step us using image+importrange function in different spreadsheet:
=IMAGE(IMPORTRANGE("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX","'XXXXXXXXXXXXXXXX'!O2")).
This loads an image usually without any problem (apart from sometimes when the image simply doesn't load, god knows why):
Final step is using "Publish to the web" function in spreadsheets and then URL embed function in Datastudio - result is okay with pictures fully loading, however after exporting the data studio report into pdf (only way to download it), the images appear broken. All spreadsheets have sufficient rights and this is happening even if the base spreadsheet is set as public (+ results numbers are okay even in the pdf, so this should be the reason).
Okay so I have no idea why, when or how, but exporting to pdf works with images included today.

Extract images from .swf viewer?

I'm wondering how it possible to extract images from .swf viewer?
Note that .swf file have not images itself.
For example I'm trying extract images from AVON catalogue from this link - http://avon.com.ua/PRSuite/eBrochure.page?index=1&cmpgnYrNr=201404&pageNo=0
Any ideas?
Best way is to put the .swf file in a decompiler for image extraction. Decompilers are smart enough to extract images for you and arrange them.
JPEXS Free Flash Decompiler is a more popular one
http://www.free-decompiler.com/flash/
You can extract other useful content from it as well.
Just download the .swf file from the website
A while back (like around 1999) I wrote a set of tools for Flash animations.
One of the tools is swf_dump which can be used to extract objects (i.e. write the objects in a form of script that sswf can nearly recompile...)
The tool also allows for extracting images that are inline (not downloaded dynamically by the flash animation, if so, anyway, you could as well download those images manually, you'd need the URL, though.)
The command line you can use is:
swf_dump -d my-animation.swf
Then your current folder will be littered with all the images that were found in the flash file. It extracts JPEGs and PNGs. The source can be compressed (SWF or CWF are supported.)
Now, you're on your own to compile that thing... The project is here and is in great need of updating (but Flash is kind of going out too...)
https://sourceforge.net/projects/sswf/

Ruby pdf testing in browser

Has anyone been able to find a way to test pdf's with ruby within the browser? I have tried a few different ways and the only way I have been able to get any pdf testing to work is to save off the pdf and use the pdf_reader gem. This only seems to work on pdf's that, when the link is clicked, opens up a dialog box with the options to open or save the pdf. Unfortunately I have not been able to find a way to do anything like this with pdf's that are opened in browser, with no dialog box options to save it. Any ideas?
Maybe testing it in the browser isnt the best way. When you say test the pdf what are you trying to do? I wouldnt test the pdf in the browser if I was you.
Try docsplit, if you want to verify its contents.
Docsplit is a command-line utility and Ruby library for splitting apart documents into their component parts: searchable UTF-8 plain text via OCR if necessary, page images or thumbnails in any format, PDFs, single pages, and document metadata (title, author, number of pages...)
You are not inventing a browser, or a PDF generator.
Use unit tests to check your back-end modules can take data in, and write PDF out, then serve the PDF in a website and let the browser do its thing. Test (as what Rails calls a "functional test") that the MVC will produce a web page containing a link to the PDF, and you are done.
You can use gem 'mechanize' to download an online PDF (the PDF with in a browser) on your computer and then read it via gem PDF reader.

Previews of matlab figures in Windows explorer (utility to set an image as the thumbnail for another file)

Has anyone come up with a way to make thumbnail type previews for matlab figures in windows?
I'm getting tired of saving a .png along with the .fig file just so I know what was in it.
A useful helper for this would be a command line utility for windows that can be provided with an image file and told to use that as the basis for the preview for a given file.
I could write a helper function in matlab that saved the .fig, made a temporary image file, then pushed that into the thumbnail using the command line utility.
You can write a function in C++ that tells Windows how to generate thumbnails from your file.
This link explains about it. Check out the section about Thumbnail Image handler. This is the function that you will need to implement.
From what I managed to understand, the procedure is this:
Write a in-process COM server (DLL) that implements IThumbnailProvider interface
Put the DLL file somewhere on your computer.
Write an entry to the registry, by using the procedure described in this page.
That still leaves you with the problem of thumbnail extraction from .fig file. As far as I know, fig files are nothing but mat files. I am fairly sure that it is possible.
You will need a custom save function for all figures. It will print a thumbnail of the image (by using the print command), and save it inside the figure.
I know that it isn't much information, but it can help you to get started. You might as well ask someone who is highly proficient in COM technology for more help. Thus, I recommend adding a COM tag to the question.
Edit(1) - I've found a good tutorial on the subject:

Converting an Image type PDF to an OCR enabled PDF

I'm not sure if my title is overly descriptive of what I'm trying to do so I will try and elabarate.
I've been asked to develop a small application where someone can upload a PDF to the website. The website is coded in ASP classic but I don't mind going down the route of .net.
Once uploaded the code needs to check if the PDF is text based if it is not it needs to then convert the document over to the text type PDF.
Does anyone have an idea of a component that can do this image PDF to text PDF conversion? So far i've looked into:
http://pages.cs.wisc.edu/~ghost/
http://www.websupergoo.com/abcocr-1.htm
I didn't overly understand what the ghost thing was doing and the websupergoo solution appeared to be converting images into text files?
I think you could use one of several websites that let you upload an image and send you back an OCR'ed data. Try www.ocrsdk.com, it is a cloud based OCR SDK recently launched by ABBYY. It's now in closed beta so it's completely free to use.
If you can afford a commercial option, you could use Amyuni PDF Creator .Net with asp.net, or Amyuni PDF Creator ActiveX if you want to stay on asp-classic. Take a look on the OCR module for PDF-Image to PDF-Text processing.
Usual disclaimer applies

Resources