Arquivo da tag: PDF
jsPDF – HTML5 PDF Generator
Apache PDFBox – A Java PDF Library
The PDF::Reader library implements a PDF parser conforming as much as possible to the PDF specification from Adobe.
Prawn: Fast, Nimble PDF Generation For Ruby
PDFBox – How to read PDF file in Java
pom.xml
[code type=xml]
Class
[code type=java]
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.text.PDFTextStripper;
import org.apache.pdfbox.text.PDFTextStripperByArea;
import java.io.File;
import java.io.IOException;
public class ReadPdf {
public static void main(String[] args) throws IOException {
try (PDDocument document = PDDocument.load(new File(“/path-to/abc.pdf”))) {
document.getClass();
if (!document.isEncrypted()) {
PDFTextStripperByArea stripper = new PDFTextStripperByArea();
stripper.setSortByPosition(true);
PDFTextStripper tStripper = new PDFTextStripper();
String pdfFileInText = tStripper.getText(document);
//System.out.println(“Text:” + st);
// split by whitespace
String lines[] = pdfFileInText.split(“\\r?\\n”);
for (String line : lines) {
System.out.println(line);
}
}
}
}
}
http://www.mkyong.com/java/pdfbox-how-to-read-pdf-file-in-java/
PSPDFKit – The leading cross-platform solution for integrating PDFs into your app.
Rails – How to convert PDF to Excel or CSV
In Rails 4:
require 'httmultiparty'
class PageTextReceiver
include HTTMultiParty
base_uri 'http://localhost:3000'
def run
response = PageTextReceiver.post('https://pdftables.com/api?key=myapikey', :query => { f: File.new("/path/to/pdf/uploaded_pdf.pdf", "r") })
File.open('/path/to/save/as/html/response.html', 'w') do |f|
f.puts response
end
end
def convert
f = File.open("/path/to/saved/html/response.html")
doc = Nokogiri::HTML(f)
csv = CSV.open("path/to/csv/t.csv", 'w',{:col_sep => ",", :quote_char => '\'', :force_quotes => true})
doc.xpath('//table/tr').each do |row|
tarray = []
row.xpath('td').each do |cell|
tarray << cell.text
end
csv << tarray
end
csv.close
end
end
http://stackoverflow.com/questions/30183738/how-to-convert-pdf-to-excel-or-csv-in-rails-4
PDF Explicado
Nota do livro: 10.