Recent

Author Topic: muPDF  (Read 28825 times)

Blestan

  • Sr. Member
  • ****
  • Posts: 461
muPDF
« on: March 12, 2013, 09:22:24 am »
Hi!
I started a project to bind fpc/lazarus to mupdf library....
pdf rendering is functional and i look for some help to port all the fuctionality of libmupdf to lazarus...
now a simple pdf reader is working and it's pretty fast :) mupdf is a great lib!!!

Speak postscript or die!
Translate to pdf and live!

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: muPDF
« Reply #1 on: March 12, 2013, 10:35:22 am »
I started a project to bind fpc/lazarus to mupdf library....
pdf rendering is functional and i look for some help to port all the fuctionality of libmupdf to lazarus...
now a simple pdf reader is working and it's pretty fast :) mupdf is a great lib!!!

Did you publish it somewhere?
What exactly are the problems you face in porting now?

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: muPDF
« Reply #2 on: March 16, 2013, 08:14:19 am »
Any news on this (even if only very unfinished)?

I could do with a pdf display capability from within Lazarus ;)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: muPDF
« Reply #3 on: March 16, 2013, 08:23:03 am »
it works quite well ... i'm using a bgrabitmap as an internal pixmap to fitz / mupdf .... the mupdf lib is pretty fast and the lazarus rending is excelent .., the code needs polishing... exceptoon handling ... may be class warp .... etc ... and avery strange ... the rendered bitmap is fipped verticaly ... i know that this i because of the different origin of zero between pdf and canvas but i cannot find a proper way to set the trasform matrix of mupdf rendering
Speak postscript or die!
Translate to pdf and live!

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: muPDF
« Reply #4 on: March 16, 2013, 09:45:01 am »
Ok. If you publish the source in a repository (bitbucket, github, google code, sourceforge...) somewhere, let us know - I'm sure there are people willing to look at it..
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

mica

  • Full Member
  • ***
  • Posts: 196
Re: muPDF
« Reply #5 on: March 16, 2013, 01:41:16 pm »
i would be interested in the Fitz/mupdf bindings too.

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: muPDF
« Reply #6 on: March 17, 2013, 10:21:52 am »
Mupdf bindings published in github under blestan / lazmupdf... enjoy :)
Speak postscript or die!
Translate to pdf and live!

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: muPDF
« Reply #7 on: March 17, 2013, 10:35:49 am »
Thanks a lot ;)

Added it as an optional download to the development version of the fpcup fpc/Lazarus svn downloader/installer (see bitbucket link in signature).
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: muPDF
« Reply #8 on: March 19, 2013, 07:47:10 am »
Had a quick look - it looks very good already!

Will have a better look when I get to my papertiger scanning/OCR project again (repository via signature)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: muPDF
« Reply #9 on: March 19, 2013, 09:33:06 am »
Had a quick look - it looks very good already!

How to test it?

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: muPDF
« Reply #10 on: March 19, 2013, 09:39:23 am »
There's a demo program included under the test directory with a test pdf. The required mupdf.dll for windows is included as well.

You'd probably have to compile an .so yourself if on Linux; instructions in readme.txt point to the way the (IMO excellent) sumatrapdf reader on Windows compiles mupdf into a library.

Compile & run the demo, press the button to open a pdf & voila... worked for me ;)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: muPDF
« Reply #11 on: March 19, 2013, 10:29:47 am »
I didn't have BGRABitMap installed in this 64-bit Linux machine. I tried to install it. I have FPC 2.6.2 now.
I get:
  lazpaint-code/bgrabitmap/bgrasse.pas(159,21) Fatal: Internal error 201001032

Code: [Select]
{$ifdef BGRASSE_AVAILABLE}
procedure Add3D_AlignedSSE(var dest: TPoint3D_128; const src: TPoint3D_128); assembler;
asm
  movaps xmm0, [dest]   <-- here

Then I undefined BGRASSE_AVAILABLE and get this:
  lazpaint-code/bgrabitmap/bgrasse.pas(232,8) Error: Unknown identifier "RBX"

Code: [Select]
procedure ClearPoint3D_128(out v: TPoint3D_128);
{$ifdef cpux86_64} assembler;
asm
  push rbx   <-- here

I got the code like this:
 $ svn checkout svn://svn.code.sf.net/p/lazpaint/code/ lazpaint-code

Lazarus and many other apps compile fine. Anyway, this is OOT for muPDF ...

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: muPDF
« Reply #12 on: March 19, 2013, 12:14:44 pm »
Hi!
lazarus BGRA bitmap is used to simnplify the internal draw the rendered page ... if you use linux you can use another bitmap type to render ... i'm not familiar with linux supported bitmaps ...
but instead of using deviceBGRA use DeviceRGB and transfer the data in a loop to your bitmap memory then draw it on the canvas of the X screen

regards,
Blestan 
Speak postscript or die!
Translate to pdf and live!

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: muPDF
« Reply #13 on: March 19, 2013, 04:26:39 pm »
lazarus BGRA bitmap is used to simnplify the internal draw the rendered page ... if you use linux you can use another bitmap type to render ... i'm not familiar with linux supported bitmaps ...
but instead of using deviceBGRA use DeviceRGB and transfer the data in a loop to your bitmap memory then draw it on the canvas of the X screen

BGRABitmap is cross-platform, isn't it?

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: muPDF
« Reply #14 on: March 19, 2013, 04:37:13 pm »
I cannot talk about bgrabitmap ... i used it in my example just to simplify the rendering and avoid huge memory copiing by using the default memory buffer of bgra bitmap ...
you can use standart bitmap and copy scanlines from mupdf pixmap to rgb bitmat and discard the alpha component ...
for any bgra questions please ask the maintainner/creator of the pack
Speak postscript or die!
Translate to pdf and live!

 

TinyPortal © 2005-2018