Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[JS] Possible to generate pdf with text and images?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Wed Mar 10, 2010 7:48 am    Post subject: [JS] Possible to generate pdf with text and images? Reply with quote

Hello everyone.

JSPDF does not work correctly in internet explorer. Basically it creates a pdf in a buffer and includes as a data uri. While this is good it does not work very well in modern browsers. So does anyone know a good way of doing this.

If you are going to tell me another api it has to be open source and therefor also free.

edit:

Code:
window.open('data:application/pdf;base64,'+Base64.encode(buffer),'_blank');

This code gives me an error that you need to intall an application.

_________________
Intel over amd yes.


Last edited by NINTENDO on Wed Mar 10, 2010 10:21 am; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
shhac
Expert Cheater
Reputation: 0

Joined: 30 Oct 2007
Posts: 108

PostPosted: Wed Mar 10, 2010 8:58 am    Post subject: Reply with quote

the app it probably wants you to install would be called adobe reader, to view the .pdf in your browser Wink or because it doesn't know how to handle the data:, which really looks like something that should've been sent in the page header anyway.

Also, the conversion probably needs to be done server-side, not client-side, in which case there are much faster options available than JS.
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Wed Mar 10, 2010 10:20 am    Post subject: Reply with quote

shhac wrote:
the app it probably wants you to install would be called adobe reader, to view the .pdf in your browser Wink or because it doesn't know how to handle the data:, which really looks like something that should've been sent in the page header anyway.

Also, the conversion probably needs to be done server-side, not client-side, in which case there are much faster options available than JS.

Hi. The offical source code does the same thing. And it needs to be client sided in my case. Client want it to work with webmaster.

It works fine in chrome but not in any other browser.

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
shhac
Expert Cheater
Reputation: 0

Joined: 30 Oct 2007
Posts: 108

PostPosted: Wed Mar 10, 2010 1:53 pm    Post subject: Reply with quote

If it works in chrome but not others then try debugging for them:
1. See if using <object> works
Code:
var elm = document.createElement('object');
elm.type = 'application/pdf';
elm.data = 'data:application/pdf;base64,'+Base64.encode(buffer);
document.body.appendChild(elm);

2. Check that Base64 is working on its own, i.e.
Code:
alert(Base64.encode(buffer));
or
console.log(Base64.encode(buffer));

3. Not sure what happens when trying to access image data via JavaScript when using FireFox/IE/Opera, you might not have permission by default. Hence try just text/just images see what happens there.
4. (well this could be 1, depending) Make sure that everything is properly defined, e.g. you didn't say how buffer is set, or how Base64 was defined (though I'm guessing you're using webtoolkit.base64.js).
Back to top
View user's profile Send private message
rapion124
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Mar 2007
Posts: 1095

PostPosted: Thu Mar 11, 2010 9:41 pm    Post subject: Reply with quote

PDF generation would best be done on the server-side using PHP.
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Thu Apr 15, 2010 2:39 am    Post subject: Reply with quote

rapion124 wrote:
PDF generation would best be done on the server-side using PHP.

I don't have no server in my case.

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites