PDF Class

It does add a space on the end of the byte stream (it needs a space between each hex byte).

But even when I use DCtDecode (where there are no space) it is corrupt. As in nothing will load it… unlike before… where it would load, but Acroreader wanted to fix it.

A space between every byte? Are you sure?

BTW, here is a link to a thread on the old RS forums with pure RS code to implement ASCII85 encoding/decoding: Base85 (Be sure to read to the end of the thread as the code gets better.)

ASCII85 may be preferable anyway as it generally results in a smaller string than the hex rendition…

Thanks for that… it didn’t work either…
Something makes me think the data I am encoding is the problem… not the manner in which it is encoded

basically I am converting the Picture to a string (which I THOUGHT would be the right data) by doing this

  mb=p.GetData(p.FormatJPEG,p.QualityMax)
  jpeg=mb.StringValue(0,mb.size)

Dang… .keeping track of pointers in PDF is a pain…
Fixed the “corrupt” part … I had the PAGES pointer pointing at the XOBJECT…oops…

However…no picture :frowning:

Your link is broken. (It seems that the “Link” functionality on this forum is causing lots of confusion…)

Are you saying that you are now able to open the PDF in a viewer, but the picture data doesn’t show up? If so, is it possible that the picture isn’t positioned and/or scaled where you think it is? If you can post a link to the PDF, I can examine it in Acrobat Pro and/or Illustrator.

Onward!

Well, from development of DynaPDF I know that it’ll take years to get things done right. Handling images in all the options will be a challenge. Not to forget fonts with all the varieties. And how much hours do you put in compared to taking existing plugin like DynaPDF Starter?

This is quite true, but I think that Dave’s goal for functionality is quite more limited than DynaPDF’s.

While it’s still not a trivial task, I think it is doable. I don’t know whether it’s worth doing as compared to using DynaPDF starter, but Dave seems to be making good progress, and I’m hoping that he succeeds.

Christian… I am not concerned nor impressed with the amout of time that went into DynaPDF. I have put about 4 DAYS into SimplePDF and my design and requirement specifications are quite rigid and controlled. I expect to have DrawPicture working quite soon. And when it is complete it will be able to drop into existing code that creates a PRINTER graphics object and be 100% code compliant.

Peter. There was no link… this forum just “made it up”. But yes… the PDF now opens but the picture does not show up. Position/Scale is the first thing I thought of as well… so I looked at the “cm” command and based on examples I have found it “looks” right.

Can’t “post” the PDF code here as it has binary characters… in a while I will put in on my website and post the URL… Thanks

I’ll keep an eye out…

The main limitation I always found frustrating with Asher’s class was that it didn’t support links (either within the document or external, to a website). Are you planning on supporting links?

feature creep raises it’s nasty head :stuck_out_tongue:

Well, in our DynaPDF examples we have one of the examples mimic a Graphics like class. Including DrawPicture there, I think.
The bigger problem is that the plugin can’t provide a Graphics subclass as that is not supported.

[quote]Dave S
Thanks for that… it didn’t work either…
Something makes me think the data I am encoding is the problem… not the manner in which it is encoded

basically I am converting the Picture to a string (which I THOUGHT would be the right data) by doing this

mb=p.GetData(p.FormatJPEG,p.QualityMax)
jpeg=mb.StringValue(0,mb.size)[/quote]

Dave Try

[code]
Dim f as folderItem
Dim b as binaryStream
Dim xPic as picture

xPic = newpicture(pic.width,pic.height,pic.depth)
xPic.graphics.DrawPicture pic, 0,0

f=getTemporaryFolderItem
f.SaveAsJPEG xPic

b=f.openAsBinaryFile(false)
JpegData=b.Read(b.Length)

b.close[/code]

Note: The JpegData is the string containing jpeg data. Remember you will have to use a “[/DCTDecode]” filer for the content stream. Also you will need to use the newer Picture class. This is code from my very old PDF engine.

Thanks … I had something “similar” to that at first… but not quite the same… will try your idea in the morning

Why draw pic into xpic?

and by “newer picture class” you mean “xPic=NEW Picture(…”

Well I put in the code that Sean mentioned… and it seemed to produce the same stream data…
but still no joy :frowning:

the Xobject looks like this

4 0 obj
<< /Type /XObject /SubType /Image
/Width 16 /Height 16 /Length 2979
/ColorSpace /DeviceRGB /BitsPerComponent 8
/Filter /DCTDecode
stream
...... JPEG STREAM DATA GOES HERE......
endstream
endobj

the Pages object looks like this

5 0 obj
<<
   /Type /Pages
   /MediaBox [0 0 612 792]
   /CropBox [36 36 576 756]
   /Kids [6 0 R]
   /Count 1
   /Resources << /Font << /F5 3 0 R >> /Xobject <<  /img0 4 0 R  >>   >>
>>
endobj

and finally the PAGE and CONTENT objects look like this
the rg sets color to RED, “re f” draws a filled rect
the Image code should be from the small “q” to the capital “Q” where “img0” matches the resource above

6 0 obj << /Type /Page /Parent 5 0 R /Contents 7 0 R >> endobj

7 0 obj
<< /Length 66 >>
stream
1. 0. 0. rg
131 661 26 -26 re f
q
16 0 0 16 136 656 cm
/img0 Do
Q
endstream
endobj

Any link to an example PDF?

don’t you see the private message??? I have been updating it all evening

Dave, are you seeing any errors?