can mpdf use fpdi-pdf parser extension? - tcpdf

I've been working with mpdf in order to join pdf files and adding internal links to its pages. I was forced to add fpdi-pdf parser to handle pdf files > v 1.4. I'm having some issues to make them work together because they require class extension and I can't have a class extending both mpdf and fpdi-pdf parser.
There is an easier option to do this integration using tcpdf instead of mpdf, however it would be a pain to lose my entire work with mpdf.
Can you guys give me some advice in this case?

mPDF v7 doesn't require class extending. Just install v1 of FPDI and the FPDI PDF-Parser and mPDF will use this under the hood.
FPDI v2 in mPDF is planned for mPDF v8.

Related

yo generate with tabs instead of spaces

I'm going to use the angular generator for this example. All files that have indentation are generated with a 2 spaces indentation by default but I want to use tabs instead.
Is there a way to let yo know that I want to use tabs before generating the app?
edit: it seems this is underway but not available as of now.
See https://github.com/yeoman/generator/issues/460
As of version 0.18, generators can use gulp plugins to process file writes. This allows generators to ask a user their preferred indentation and apply it to the output.
You can see more about this technical detail on the release announcement: http://yeoman.io/blog/release-0.18.html
It is important to note that every generator is free to implement that feature. It is not something yo will (or can) enforce on his own. So feel free to open tickets on the generators you'd like to see implementing that feature.

How can I inject a dynamically generated image (barcode, as it happens) into a PDF document (I'm in rails if that matters)?

I'm aware of pdf-stamper, but I'm trying to avoid switching everything to jruby right now.
I just need to "stamp" an image that I generate within the rails app (a PDF417 barcode) into a form field in the PDF document (there's an FDF; it's a document template kinda thing).
I'm filling out the text-based fields by just shelling out to pdftk, so if there's a way to do it using pdftk, I'd be fine with that, but I've looked high and low for one without any luck.
How about using a barcode font? some alternatives too. I haven't used that one but there may be others available too
I know I'm late to the party, but the PDF417 Rubygem should do what you need. https://rubygems.org/gems/pdf417 will generate it and if you have chunky_png installed you can easily write out PNGs to a file.

handling wiki links with markdown in ruby

I'm building a simple app with Rails using Markdown for storing content. My question is how to build internal [[wiki]] style links? Either by pre-processing before they get to markdown or some markdown derivative? I release I could probably preprocess using regex, but I'm guessing there are others with ready built solutions.
For example I know Instiki uses both markdown and [[wiki|Wiki]] links and I've looked but couldn't figure out how they're handling it.
Any tips?
If you are using the redcarpet gem you can either use a preprocessor or you can modifiy the generated HTML output.
Have a look at How to extend Redcarpet to support a media library. This article shows how to convert image references to custom HTML and also how to replace boilerplate identifiers with the actual content.
I guess both approaches could be adapted for your specific problem:
The renderer approach directly manipulates the generated HTML code from the markdown code. (This is more elegant as you are not messing with Markdown code)
The preprocess approach manipulates the code by using regular expressions (as you already mentioned) (This is more flexible, but also a little bit messy)

What are the advantages of using Builder over regular xml files?

I have a Rails application which is using the Builder gem for writing easy to use XML files.
I am very much satisfied with the Builder gem but, as per my product architect's view, we should always use simple .xml files instead of using third party tools.
So, I need to give a solid justification to him explaining to him about the advantages of using Builder over regular XML files in our Rails application.
Can anyone give or guide me to a valid justification on the usage of Builder over regualr RXML/XML files in a Rails application?
If your xml files are static than he is correct and there is no benefit of friting them using any sort of xml template. If you are using it for dynamic content than you gain all of the benefit of template language such as sharing the code between templates, caching etc
He can be as high minded as he likes, but Builder 3.0 comes with any brand new rails 3 app. It's already in your gem bundle, why not utilize it? It's like saying ActiveRecord or JQuery shouldn't be used because we shouldn't rely on a third party tool. Since you're already using rails and all of the open source software that comes with it, what's wrong with Builder?
That being said, as Yuiry pointed out, the advantage is that builder is dynamic whereas a .xml is static.

Is Prince the best way to create PDFs in Ruby on Rails?

After several Google searches, it appears that the way to create PDFs in Rails from HTML and CSS (versus a new markup language) is to use Prince.
With licensing at $3800 for my non-big-commercial app, I'm wondering if this is, in fact, consensus or people have an alternative they can share the whats and hows.
You may check out prawn too. Tutorial can be found on railscasts.com.
This may fit the bill: http://code.google.com/p/wkhtmltopdf/
We tried tow solutions:
using latex generate pdf, there is ruby gem code rtex
using java library iText, use it you may need rjb which allow you using java lib directly in ruby code, just like jruby, but you don't need build all you application on jruby.
I create tons of different PDF files on the fly from various data sources using Rails, including finest layout. I create need to create them for presenting products to customers.
After having tried all the tools mentioned above, Prince is the best tool for this task.
Prince's rendering quality & CSS support (better than some browsers) is its main selling point. If you're only generating documents with simple layouts, stick with Prawn.

Resources