Lazarus

Programming => Packages and Libraries => FPvectorial => Topic started by: gummi.bear on September 15, 2017, 02:17:39 pm

Title: FPvectorial "Unsupported vector graphics" - PDF
Post by: gummi.bear on September 15, 2017, 02:17:39 pm
I am trying to plot a pdf file to a canvas using the procedure

Code: Pascal  [Select][+][-]
  1. procedure TmainForm.plotPDF(PlotFileName: string; Dest: TCanvas);
  2. var
  3.   Vec    : TvVectorialDocument;
  4.   lFormat: TvVectorialFormat;
  5. begin
  6.  
  7.    Vec := TvVectorialDocument.Create;
  8.   try
  9.     lFormat := TvVectorialDocument.GetFormatFromExtension(PlotFileName);
  10.     Vec.ReadFromFile(PlotFileName, lFormat);
  11.     DrawFPVectorialToCanvas(Vec.GetPageAsVectorial(0), Dest, 0, 0, 1.0, -1.0);
  12.   finally
  13.     Vec.free;
  14.   end;
  15. end;
  16.  

but I am getting the "Unsupported vector graphics format." message from Vec.ReadFromFile(PlotFileName, lFormat). Are there some requirements on the format of the pdf files? My pdfs are generated by R (attached below).
Title: Re: FPvectorial "Unsupported vector graphics" - PDF
Post by: wp on September 15, 2017, 02:27:54 pm
Since fpvectorial links reader/writer units only for the formats needed you must add pdfvectorialreader to the uses clauses of your program. But I doubt that you'll be able to read this file with fpvectorial. As I saw recently this format is supported only in a very basic way.
Title: Re: FPvectorial "Unsupported vector graphics" - PDF
Post by: molly on September 15, 2017, 02:28:34 pm
Code: [Select]
    Vec.ReadFromFile(PlotFileName, lFormat);
but I am getting the "Unsupported vector graphics format." message from Vec.ReadFromFile(PlotFileName, lFormat). Are there some requirements on the format of the pdf files? My pdfs are generated by R (attached below).
According to fpvectorial textdoc wiki (http://wiki.freepascal.org/fpvectorial_-_Text_Document_Support):

Quote
TODO
General
  • Comprehensive testing, including opening the files in as many word processors and office suites as possible.
  • DOCX and ODT Readers (volunteers required)
  • Add PDF reader/writer (current PDF support is for Vector Image support only)
  • Add HTML reader/writer
  • Add RTF reader/writer
  • Produce well documented examples and store in FPVectorial/Examples
  • Code Documentation for distributing with Lazarus

and fpvectorial wiki (http://wiki.lazarus.freepascal.org/fpvectorial) reads:
Quote
Readers for various image formats:
pdfvectorialreader - Read support for PDF files, supports compression, only reads the first page
Title: Re: FPvectorial "Unsupported vector graphics" - PDF
Post by: gummi.bear on September 15, 2017, 02:51:06 pm
Quote
Readers for various image formats:
pdfvectorialreader - Read support for PDF files, supports compression, only reads the first page

My pdf files have one page only and should be vector images. I also tried to turn off the compression in R, but it didn't help. I assumed that there is some support for pdf files because they are mentioned on the wiki page. So maybe only my format is wrong?
Title: Re: FPvectorial "Unsupported vector graphics" - PDF
Post by: wp on September 15, 2017, 03:57:24 pm
The problem is that the pdfreader does not even compile... It is certainly not too difficult to make it work, but I don't have the time to focus on this issue. Patches are welcome.
TinyPortal © 2005-2018