Recent

Author Topic: FPvectorial "Unsupported vector graphics" - PDF  (Read 3838 times)

gummi.bear

  • Newbie
  • Posts: 4
FPvectorial "Unsupported vector graphics" - PDF
« 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).

wp

  • Hero Member
  • *****
  • Posts: 6318
Re: FPvectorial "Unsupported vector graphics" - PDF
« Reply #1 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.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

molly

  • Hero Member
  • *****
  • Posts: 2345
Re: FPvectorial "Unsupported vector graphics" - PDF
« Reply #2 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:

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 reads:
Quote
Readers for various image formats:
pdfvectorialreader - Read support for PDF files, supports compression, only reads the first page
« Last Edit: September 15, 2017, 02:31:30 pm by molly »

gummi.bear

  • Newbie
  • Posts: 4
Re: FPvectorial "Unsupported vector graphics" - PDF
« Reply #3 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?

wp

  • Hero Member
  • *****
  • Posts: 6318
Re: FPvectorial "Unsupported vector graphics" - PDF
« Reply #4 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.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10