PurePDF Version 2.0

Developed or developing a new product in PureBasic? Tell the world about it.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

Please upload those images somewhere so that i can test whats going wrong.
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: PurePDF Version 2.0

Post by StarBootics »

ABBKlaus wrote:Please upload those images somewhere so that i can test whats going wrong.
I think I don't need to upload image, I have use the pdf_GetErrorMessage() to see what is going on.
Debugger wrote:Alpha channel PNG not supported.
And my first png logo use alpha channel. I have try to save my logo as jpeg image using "The Gimp" V2.8 and apparently if I use the "Progressive" option :
Debugger wrote:Not a JPEG file.
Apparently the Progressive image load for the web generate a bug. I hope this will help you to figure out this bug.

Regards
StarBootics
The Stone Age did not end due to a shortage of stones !
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: PurePDF Version 2.0

Post by IdeasVacuum »

see also Pages 18/19 of this post - there are a number of things to be aware of concerning image size and dpi.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

ok progressive works now. please redownload the latest Version from my site ;-)

Code: Select all

Procedure ipdf_ParseJPG(*aData.MEM_DataStructure)  
  Protected vStart,vLength,vFound,vResult,vByte.b
  
  ;Block Length
  vLength = ((PeekB(*aData\pData + 4) & $FF)*$100) + (PeekB(*aData\pData + 5) & $FF)
  vStart = 4 + vLength     
  vFound = #False
  While (vFound <> #True) And (vStart + 9 < *aData\lCurSize)
    vByte=PeekB(*aData\pData + vStart) & $FF
    If vByte = -1
      vByte = PeekB(*aData\pData + vStart + 1) & $FF
      If (vByte = -64) Or (vByte = -62)
        vFound = #True
        Images()\Bpc = PeekB(*aData\pData + vStart + 4)
        Images()\Height = ((PeekB(*aData\pData + vStart + 5) & $FF)*$100) + (PeekB(*aData\pData + vStart + 6) & $FF)
        Images()\Width =  ((PeekB(*aData\pData + vStart + 7) & $FF)*$100) + (PeekB(*aData\pData + vStart + 8) & $FF)
        ; Gray = 1/Color = 3
        Select PeekB(*aData\pData + vStart + 9) & $FF
          Case 1
            Images()\ColSpace = "DeviceGray"
          Case 3
            Images()\ColSpace = "DeviceRGB"           
          Default:
            Images()\ColSpace = "DeviceCMYK"               
        EndSelect    
        Images()\DataPic\pData = *aData\pData
        Images()\DataPic\lCurSize = *aData\lCurSize
        vResult = #True
      Else
        ;Block Length
        vLength = ((PeekB(*aData\pData + vStart + 2) & $FF)*$100) + (PeekB(*aData\pData + vStart + 3) & $FF)
        vStart = vStart + vLength + 2
      EndIf      
    Else
      pdfError = #PDF_ERROR_JPEG_FILE_IS_NOT_SUPPORTED
      vResult = #False
      Break
    EndIf    
  Wend  
  ProcedureReturn vResult
EndProcedure
User avatar
Lord
Addict
Addict
Posts: 900
Joined: Tue May 26, 2009 2:11 pm

Re: PurePDF Version 2.0

Post by Lord »

Hi!

Did I miss something or is it not possible to
include an image without saving it first to
HD an then reload this image?
pdf_Image() needs a path to an image. so
I can't use a drawing wich I want to include
in a pdf file.
A pdf_Image(#Img, ...) would be a nice feature.
Image
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

Did you try pdf_ImageMem() ?

Its not possible with PureBasic commands to create a JPG or PNG in Memory. Maybe there´s an api way ?

[/Edit]Found it : *Buffer = EncodeImage(#Image [, ImagePlugin [, Flags [, Depth]]])[Edit]
Loopingstar
User
User
Posts: 18
Joined: Tue Oct 01, 2013 12:57 pm

Re: PurePDF Version 2.0

Post by Loopingstar »

I give an example of "encodeImage" in another of my posts: http://www.purebasic.fr/english/viewtop ... 13&t=56927, with the help of Chris :)
Last edited by Loopingstar on Wed Oct 09, 2013 8:23 am, edited 1 time in total.
User avatar
Lord
Addict
Addict
Posts: 900
Joined: Tue May 26, 2009 2:11 pm

Re: PurePDF Version 2.0

Post by Lord »

ABBKlaus wrote:...
[/Edit]Found it : *Buffer = EncodeImage(#Image [, ImagePlugin [, Flags [, Depth]]])[Edit]
Yup, that's the way to go.
I didn't know, that the path string in pdf_ImageMem() isn't relevant.
Thanks for this hint (and PurePDF anyway :D )
Loopingstar wrote:I give an example of "encodeImage" in another of my posts: http://www.purebasic.fr/english/viewtop ... 13&t=56927
Thank you for this additional example.
Image
mcsalsa
User
User
Posts: 17
Joined: Thu Sep 28, 2006 1:20 pm

Re: PurePDF Version 2.0

Post by mcsalsa »

Unicode for Japanese.

I am trying to use Japanese chars with PurePDF, I have followed the Tutorial regarding unicode and when printing a char like Chr(12452), with the font "Lucida Sans Unicode", compiler set to "Create Unicode Executable" I get a Square.

In order to check the problem if you use "XIncludeFile "Source\PurePDF.pb" then in the Debug window we see this error: "Font contains a broken glyph code mapping, ignored" ... someone has found the same trouble?

Thanks
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: PurePDF Version 2.0

Post by IdeasVacuum »

First thing to do then is try another font.........
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

There is no char in that font with $30A4 (12452) :wink:

What char do you want ?
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

Hi all,

i fixed two issue´s with unicode fonts. Please redownload the latest version from my website.
- ipdf_Handle_MS_Encoding() changed variable n.w to n.u
- ipdf_Handle_MS_Encoding() fixed broken glyph code detection
User avatar
Lord
Addict
Addict
Posts: 900
Joined: Tue May 26, 2009 2:11 pm

Re: PurePDF Version 2.0

Post by Lord »

Hi!

What went wrong here:

Code: Select all

#PurePDF_Include=1

;Put you path pointing to "PurePDF.pb" and "PurePDF.res" here:
IncludePath "....\PurePDF\Examples\PurePDF\"
;

XIncludeFile "PurePDF_res.pb"
XIncludeFile "PurePDF.pb"

Define Logo.s, myPath.s, Error.s
Define ImgW,i, ImgH.i
Define Quality.i
Define *myImgBuffer

UsePNGImageDecoder()
UseJPEGImageEncoder()

Logo.s=#PB_Compiler_Home+"Examples\3D\Data\PureBasic3DLogo.png"

;Put your path for PDF and JPG files here
myPath.s="...."
;

If LoadImage(1, Logo)
  ImgW=ImageWidth(1)
  ImgH=ImageHeight(1)
  For Quality= 0 To 10
  Debug "Loop start ---"
  *myImgBuffer=EncodeImage(1, #PB_ImagePlugin_JPEG, Quality)
  If *myImgBuffer
    Debug "Quality: "+Str(Quality)
    pdf_Create("P", "pt", Str(ImgW)+","+Str(ImgH))
    pdf_setmargins(0,0,0)
    pdf_AddPage()
    pdf_ImageMem("", *myImgBuffer, MemorySize(*myImgBuffer), 0, 0)
    Debug pdf_geterrormessage()
    pdf_Save(myPath+"\PDFTestQ"+Str(Quality)+".pdf")
    Debug pdf_geterrormessage()
    ; save JPG for reference purpose
    SaveImage(1 , myPath+"\JPGTestQ"+Str(Quality)+".jpg", #PB_ImagePlugin_JPEG, Quality)
    ;
    FreeMemory(*myImgBuffer)
  EndIf
  Debug "Loop end ----"
  Next Quality
EndIf
I'm getting a "Not a JPEG file."-Error for Quality settings 0 to 2.
SaveImage() doesn't complain for Quality=0 to Quality=2.
Image
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

Hi Lord,
Thanks for beta testing ;-)

The Extended sequential DCT was missing.

I uploaded a bugfixed version here : http://www.purebasicpower.de/?download= ... B52X86.zip
loulou
User
User
Posts: 38
Joined: Tue Dec 08, 2009 7:42 am

Re: PurePDF Version 2.0

Post by loulou »

Hi ABBKlauss,
Is it possible to print an html file in pDF with PurePDF ? If no does-it exists something to do that except with Microsoft Office or Open Offce
Thanks in advance
Post Reply