Jspdf: Generated PDF not looking gud on using pagesplit:true in addHtml()

Created on 7 Aug 2017  Â·  13Comments  Â·  Source: MrRio/jsPDF

Hi, i am using jspdf to create a pdf from HTML. there i am using pagespit: true to get the multiple pages on dynamically.its working perfectly. but the generated pdf is not looking good. it doesnot contain any marigins. it looks like in the following images.
Thanks in advance
pdf issue

All 13 comments

Well, obviously because there is no code to use margins etc...

You have to modify it by yourself

can i get any suggestions please? where i have to make modifications?

Obviously https://github.com/MrRio/jsPDF/blob/master/plugins/addhtml.js

jsPDFAPI.addHTML = function (element, x, y, options, callback) {

So by simply checking the code:
x = margin-left
y = margin-top

options.dim.h and options.dim.w should set the size of the splitted image
but i am not sure if it will work.

try to set options like this

var options = {'dim' : {'h' : 100, 'w' : 100}};

and use it for the function. If it is working: Fine. If not then maybe this is the solution:

after line 54 you add

var margin = options.margin || { 'right': 0, 'bottom' : 0};

and line 68 and 69 you change to

canvas.width = Math.min(W*K - margin.right*K,obj.width); canvas.height = Math.min(H*K - margin.top*K,obj.height-cy);

Call the new addHTML-function with an option-Objekt like this

var options = {'margin': { 'right': 100, 'bottom' : 100}};

I am sorry. I am getting errors and there is no change in the pdf view. and here is my code plaese have a look into it.var pdf = new jsPDF('p', 'pt', 'a4'), options = {pagesplit: true}; pdf.internal.scaleFactor = 1.40; pdf.addHTML($('.resume'), options, function () { pdf.save($scope.resumeData.basics.name + '.pdf');
Here i didn't set any marigins. Even though i set marigins there is no change.

And how can I help when you give me no code?

I mentioned the code in the above comment..

Are you a trained Softwaredeveloper?

Before you answer...

What you wrote as a code is nothing, with what I could even closely work. The only thing I can see is the ugly layer breaking direct change of the scaleFactor. Other than that your code is just ordinary pdf generation. If you expect from me to "analyze" this great code than you are insulting my pride.

I gave you some hints how to modify the addHtml.js. If you expect, that I write the code for you, than why do you even ask for suggestions?

So if you arent a trained Softwaredeveloper, than get trained or pay trained softwaredevelopers to develop it for you. But dont expect trained softwaredevelopers to program stuff for you for free.

I am so sorry for that. Anyways thanks for the support. I will close that.

On Wed, Aug 16, 2017 at 4:34 AM, Aras Abbasi notifications@github.com
wrote:

Before you answer...

What you wrote as a code is nothing, with what I could even closely work.
The only thing I can see is the ugly layer breaking direct change of the
scaleFactor. Other than that your code is just ordinary pdf generation. If
you expect from me to "analyze" this great code than you are insulting my
pride.

I gave you some hints how to modify the addHtml.js. If you expect, that I
write the code for you, than why do you even ask for suggestions?

So if you arent a trained Softwaredeveloper, than get trained or pay
trained softwaredevelopers to develop it for you. But dont expect trained
softwaredevelopers to program stuff for you for free.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/MrRio/jsPDF/issues/1372#issuecomment-322742662, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AVIeP7VRI82WJ25_j3ZfIHOwJdcwsDmEks5sYtOwgaJpZM4OvIyc
.

HI arasabbasi
Your code not working. I have not seen any changes.

@Dinesh-Wasnik
Well "my code" is just a suggestion. If you want to fix it, you have to analyze and program it by yourself.

No easy way out.

Ya, I am doing same.

@Dinesh-Wasnik
try #1450

Was this page helpful?
0 / 5 - 0 ratings