PDF Membership letter / certificate [Deleted]

CrispinP

Well-known member
CrispinP submitted a new resource:

PDF Membership letter / certificate - Generate a PDF for members to prove their membership.

A resource which allows you to generate membership letters or certificates for members.

This comes in handy when members get discounts from 3rd parties but have to prove their membership. This is the official proof.


  • Fairly flexible in that you can:
  • Specify the letterhead
  • Select which attributes of the letter you want to include.
  • Allow members to download it as a pdf
  • Show the join date.
  • If they have a paid-for user-upgrade then it will show the end date of that...

Read more about this resource...
 
Wow! This looks terrific, and an excellent resource.
Any thoughts on creating, on a new last page, a sort of membership card? I'm thinking credit card size that the member can print and self-laminate, that puts the name, member number, and expiry date, against a background image provided by admin in ACP? They'd then leave this in their wallet/purse and whip out when needed.
 
This error shows when using svg for Letterhead Image. Png image parsing OK.

Code:
Server Error Log
Error Info
Error: Call to undefined method Cpdf::quadTo() - library/Crispin/MembershipLetter/Includes/dompdf/lib/php-svg-lib/src/Svg/Surface/SurfaceCpdf.php:246
Generated By: Sunka, 13 minutes ago
Stack Trace
#0 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/lib/php-svg-lib/src/Svg/Tag/Path.php(276): Svg\Surface\SurfaceCpdf->quadraticCurveTo(34.6, 27.15, 34.55, 27)
#1 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/lib/php-svg-lib/src/Svg/Tag/AbstractTag.php(63): Svg\Tag\Path->start(Array)
#2 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/lib/php-svg-lib/src/Svg/Document.php(352): Svg\Tag\AbstractTag->handle(Array)
#3 [internal function]: Svg\Document->_tagStart(Resource id #27, 'path', Array)
#4 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/lib/php-svg-lib/src/Svg/Document.php(223): xml_parse(Resource id #27, ' 19.2 26.7 18.7...', false)
#5 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/lib/Cpdf.php(4571): Svg\Document->render(Object(Svg\Surface\SurfaceCpdf))
#6 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Adapter/CPDF.php(697): Cpdf->addSvgFromFile('/home/nginx/dom...', 110.14, 727.6242519685, 375, 75)
#7 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Renderer/Image.php(101): Dompdf\Adapter\CPDF->image('/home/nginx/dom...', 110.14, 39.265748031496, 375, 75, 'normal')
#8 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Renderer.php(293): Dompdf\Renderer\Image->render(Object(Dompdf\FrameDecorator\Image))
#9 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Renderer.php(127): Dompdf\Renderer->_render_frame('image', Object(Dompdf\FrameDecorator\Image))
#10 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Renderer.php(194): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\Image))
#11 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Renderer.php(194): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\Block))
#12 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Renderer.php(194): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\TableCell))
#13 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Renderer.php(194): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\TableRow))
#14 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Renderer.php(194): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\TableRowGroup))
#15 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Renderer.php(194): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\Table))
#16 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Renderer.php(194): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\Block))
#17 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Renderer.php(194): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\Block))
#18 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/FrameReflower/Page.php(140): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\Block))
#19 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(801): Dompdf\FrameReflower\Page->reflow(NULL)
#20 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Dompdf.php(834): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow()
#21 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/ViewPublic/Letter.php(42): Dompdf\Dompdf->render()
#22 /home/nginx/domains/pijanitvor.com/public/library/XenForo/ViewRenderer/Abstract.php(227): Crispin_MembershipLetter_ViewPublic_Letter->renderRaw()
#23 /home/nginx/domains/pijanitvor.com/public/library/XenForo/ViewRenderer/Raw.php(53): XenForo_ViewRenderer_Abstract->renderViewObject('Crispin_Members...', 'Raw', Array, 'Crispin_Members...')
#24 /home/nginx/domains/pijanitvor.com/public/library/XenForo/FrontController.php(606): XenForo_ViewRenderer_Raw->renderView('Crispin_Members...', Array, 'Crispin_Members...', NULL)
#25 /home/nginx/domains/pijanitvor.com/public/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_View), Object(XenForo_ViewRenderer_Raw), Array)
#26 /home/nginx/domains/pijanitvor.com/public/index.php(13): XenForo_FrontController->run()
#27 {main}
Request State
array(3) {
  ["url"] => string(54) "https://www.pijanitvor.com/membershipletter?printpdf=1"
  ["_GET"] => array(2) {
    ["/membershipletter"] => string(0) ""
    ["printpdf"] => string(1) "1"
  }
  ["_POST"] => array(0) {
  }
}


This error shows up (I think) when address is ticked, but nothing is entered in field.

Code:
Server Error Log
Error Info
ErrorException: getimagesize(): Read error! - library/Crispin/MembershipLetter/Includes/dompdf/src/Helpers.php:519
Generated By: Sunka, 18 minutes ago
Stack Trace
#0 [internal function]: XenForo_Application::handlePhpError(8, 'getimagesize():...', '/home/nginx/dom...', 519, Array)
#1 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Helpers.php(519): getimagesize('/home/nginx/dom...')
#2 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Image/Cache.php(127): Dompdf\Helpers::dompdf_getimagesize('/home/nginx/dom...', NULL)
#3 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/FrameDecorator/Image.php(57): Dompdf\Image\Cache::resolve_url('/home/nginx/dom...', '', '', '', Object(Dompdf\Dompdf))
#4 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Frame/Factory.php(213): Dompdf\FrameDecorator\Image->__construct(Object(Dompdf\Frame), Object(Dompdf\Dompdf))
#5 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/Includes/dompdf/src/Dompdf.php(801): Dompdf\Frame\Factory::decorate_frame(Object(Dompdf\Frame), Object(Dompdf\Dompdf), Object(Dompdf\FrameDecorator\Page))
#6 /home/nginx/domains/pijanitvor.com/public/library/Crispin/MembershipLetter/ViewPublic/Letter.php(42): Dompdf\Dompdf->render()
#7 /home/nginx/domains/pijanitvor.com/public/library/XenForo/ViewRenderer/Abstract.php(227): Crispin_MembershipLetter_ViewPublic_Letter->renderRaw()
#8 /home/nginx/domains/pijanitvor.com/public/library/XenForo/ViewRenderer/Raw.php(53): XenForo_ViewRenderer_Abstract->renderViewObject('Crispin_Members...', 'Raw', Array, 'Crispin_Members...')
#9 /home/nginx/domains/pijanitvor.com/public/library/XenForo/FrontController.php(606): XenForo_ViewRenderer_Raw->renderView('Crispin_Members...', Array, 'Crispin_Members...', NULL)
#10 /home/nginx/domains/pijanitvor.com/public/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_View), Object(XenForo_ViewRenderer_Raw), Array)
#11 /home/nginx/domains/pijanitvor.com/public/index.php(13): XenForo_FrontController->run()
#12 {main}
Request State
array(3) {
  ["url"] => string(54) "https://www.pijanitvor.com/membershipletter?printpdf=1"
  ["_GET"] => array(2) {
    ["/membershipletter"] => string(0) ""
    ["printpdf"] => string(1) "1"
  }
  ["_POST"] => array(0) {
  }
}


Looking promissing, but need much more estetic styling.
All is generated by tables and there is too much spaces in document between sections.
If some option is not checked to show up in document, than it just empty space there, and that is not looking very good.
Letter title is not showing anywhere in letter.


My suggestions:
  • Custom file name for pdf (when save pdf/letter to hard disk) - let we choose in acp what will be letter file name
  • Better phrases in letter so we can translate better. Or just empty fields (with html parsing) in ACP where we can write complete sections of letter.
  • Another image in footer of letter (like brand mark)
  • ...
 
This error shows when using svg for Letterhead Image. Png image parsing OK.
I'm going to guess that it's the pdf renderer which does not know how to use svg. Not much I can do about that at the moment. I'll take a look at what they support.

This error shows up (I think) when address is ticked, but nothing is entered in field.
I'll see if I can reproduce it.

All is generated by tables and there is too much spaces in document between sections.
Can you show me a screen shot? I struggled to get it to look OK for me and was hoping it'll be ok.
The renderer cannot do fancy css which is why I stuck with tables.

If some option is not checked to show up in document, than it just empty space there, and that is not looking very good.
Again, screen shot please. I'll see if I can recreate it. It should just leave out that row.

Custom file name for pdf (when save pdf/letter to hard disk) - let we choose in acp what will be letter file name
Will look at adding that in.

  • Better phrases in letter so we can translate better. Or just empty fields (with html parsing) in ACP where we can write complete sections of letter.
Everything is a xenforo phrase so you can translate it if you wanted to. I thought of adding an option to add your own HTML but think that might cause too much hassle with the renderer.

  • Another image in footer of letter (like brand mark)
Possible.


A lumpy start - sorry. But let's see if we can fix it..
 
Can you show me a screen shot? I struggled to get it to look OK for me and was hoping it'll be ok.
The renderer cannot do fancy css which is why I stuck with tables.
Again, screen shot please. I'll see if I can recreate it. It should just leave out that row.

23-47-33.webp



Will look at adding that in.
Thanks


Everything is a xenforo phrase so you can translate it if you wanted to. I thought of adding an option to add your own HTML but think that might cause too much hassle with the renderer.
My opinion is that with empty fields (with/without html parsing) in ACP where we can write complete sections of letter will be much better solution for both, you as developer and us as customers. Many problems could be solved that way. If user want to add custom text for some section of letter than he could write it, or just default text if he do not want custom own text.

A lumpy start - sorry.
(y)

P.S. I can edit templates to delete spaces, and other things, but that is not good solution
 
All the text is phrases in XenForo. ACP / Appearance / Phrases - all phrases start with crispin_ml_
That top one in particular is called crispin_ml_salutation

Is that screenshot of the website or of the pdf?

Something is odd with the address and username.
Have you filled in your personal details in User Contact details? It should have shown an error if you've not. If you have, which have you filled in? I need to see why it's not trapping the missed fields.

The big white space is to push the footer down a bit. It looks a bit too cramped otherwise.

The footer at the bottom is made up of the various fields in ACP.
They're meant to be listed one below the other. What ideas did you have? I can see if it can be included.


As for the html - it might be worth a try. I'll see what it entails and how easily the pdf writer can cope with it.
You're right though - that would allow infinite customisation.
 
Is that screenshot of the website or of the pdf?
website

Something is odd with the address and username.
Have you filled in your personal details in User Contact details? It should have shown an error if you've not. If you have, which have you filled in? I need to see why it's not trapping the missed fields.
Nop, I did not, so errors show up because of this, but mandatory fields in personal user contant details is not something most of my users will fill. Maybe some solution to fill that just before creating pdf? Like step one - fill your real name and address, step 2 creating PDF, step 3 when PDF is created erase that data in user profile.

The footer at the bottom is made up of the various fields in ACP.
They're meant to be listed one below the other. What ideas did you have? I can see if it can be included.
Maybe one row - Sunka, Administrator at xxx.com, and below that email address, or just custom field in ACP so admin can create default

As for the html - it might be worth a try. I'll see what it entails and how easily the pdf writer can cope with it.
That will be awesome than

You're right though - that would allow infinite customisation.
Custom fields in acp for sections of letter are solution for many problems
 
Nop, I did not, so errors show up because of this, but mandatory fields in personal user contant details is not something most of my users will fill. Maybe some solution to fill that just before creating pdf? Like step one - fill your real name and address, step 2 creating PDF, step 3 when PDF is created erase that data in user profile.
The details are in the user contact details. Can you see them in there?
upload_2016-10-25_11-56-27.webp

That's what it picks up.
Admittedly, if yours are blank and it's not warning you that they're blank then there is a a problem.

Maybe one row - Sunka, Administrator at xxx.com, and below that email address, or just custom field in ACP so admin can create default
Put all that into one field in the ACP and the effect will be the same.
It would be tough to cater for what you're after and what I am after (I want them in 4 rows)
The labels should perhaps read Rows1-4 and it would be more agnostic.

Custom fields in acp for sections of letter are solution for many problems
But then you cannot have them in different languages
 
One suggestion...
Could you add some random code in footer of pdf, and some log for that in ACP so if user goesto some shop for discount earned by this certificate from forum that he is part of some usergroup, so owner can e-mail me that random code and I can check is this letter is generated on my website or just homemade by user
 
Nop. I think so.
I add some suggestions, but...

I need simple one click for users - create and download pdf which contains all relevant users fields that that user is on my forum.
For example, to get some discount if he is member of my forum
 
Nop. I think so.
I add some suggestions, but...

I need simple one click for users - create and download pdf which contains all relevant users fields that that user is on my forum.
For example, to get some discount if he is member of my forum

That's something similar to what I'm after. A business card sized PDF for easy printing, board logo, username, profile pic, join date, maybe a fancy QR code with the board URL/member profile.
 
Last edited:
Back
Top Bottom