• Hello,

    in the Presentation Options (PDF icon appearance) menu it is possible to set individual image which is included in a generated link tag.
    This is a problem, when you want to implement some additional input for axample a div etc. which is also included in the link tag then.

    Can you change this option, that only the input field is included without the generated link tag?
    If this is needed anyone can copy also the link in this field.

    https://wordpress.org/plugins/wp-post-to-pdf-enhanced/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Lewis Rosenthal

    (@lewisr)

    While I agree that this is a good suggestion (th current method is a holdover from the original project from which this was forked), there are some issues with what you propose and the manner in which we use that logo image.

    Currently, we are using a function in TCPDF which operates on an image file itself. Thus, entering any additional HTML would render that function useless.

    What we really want, I suppose, is the ability to create a custom header (like the custom footer function currently under development). This way, the HTML cell may contain whatever data is desired.

    For now, if you feel adventurous, you may change the value of the PDF_HEADER_LOGO constant in tcpdf/config/tcpdf_config.php to point to whatever logo you’d like, but again, this is only to define the location of the image file itself.

    Cheers

    Lewis

    Thread Starter nima1

    (@nima1)

    Hello,

    sorry, but I think we are speaking about different topics.

    I mean the presentation options in the wordpress backend menu. It is possible to automatically integrate the PDF generation link in all content pages.

    In the input field it is possible to enter an image or a text but there are some issues, when you enter some more content because the pugin put the content of this field into a link. It should be better to have only the text field without the link generation.

    Plugin Author Lewis Rosenthal

    (@lewisr)

    My apologies; you did indeed mention the PDF icon, and for some reason, I was thinking the about the logo link being hardcoded.

    I’m not sure, however, that I follow what you are asking. This field is specifically for the link content. I believe what you want is text preceding (or succeeding, or preceding and succeeding) the icon. Can you give me a real-world example? I need a definite use case before I consider making a change, here.

    Thanks, and apologies for my earlier misinterpretation.

    Cheers

    Lewis

    Thread Starter nima1

    (@nima1)

    Hello,

    the main advantage is, that it s a more individual display option. When you only show the icon on special pages you can enter some specific html code to display.

    In the actual case some divs are insert but the problem is now, that the complete html is inside the link. As the link is only a url parameter I think it should be a good option also to paste the link into the options fiel.

    Is it more clear now?

    Plugin Author Lewis Rosenthal

    (@lewisr)

    After playing with this for a few minutes, I think I see what you want.

    Right now, we default to:

    <img alt="Download PDF" src="http://some-blog-url/wp-content/plugins/wp-post-to-pdf-enhanced/asset/images/pdf.png">

    Now, if we add text to that field, as in:

    Click here to download a PDF <img alt="Download PDF" src="http://some-blog-url/wp-content/plugins/wp-post-to-pdf-enhanced/asset/images/pdf.png">

    the text is wrapped in the <a tag. If we close the tag first:

    </a>Click here to download a PDF <img alt="Download PDF" src="http://some-blog-url/wp-content/plugins/wp-post-to-pdf-enhanced/asset/images/pdf.png">

    we shoot ourselves in the foot. There is no way to get the variables back in there (can’t execute PHP in that box – yet – but that would be the ticket to solving this and an earlier request to be able to hide the descriptive text from the PDF).

    What would be great is if we could do something like:

    </a>Click here to download a PDF <a class="wpptopdfenh" target="_blank" rel="noindex,nofollow" href="' . add_query_arg( 'format', 'pdf', get_permalink($post->ID)) . '" title="Download PDF">' . $this->options['imageIcon'] . '</a>';

    which, of course, is not currently possible.

    Okay, you’ve convinced me. 🙂 I’ll add this to my list.

    Thanks!

    Lewis

    Thread Starter nima1

    (@nima1)

    Hello,

    I am not sure why the link is related to PHP. The only thing to do is to copy the link with the url parameter ?format=pdf also in the options box, then everybody can style individual for every requirement. No PHP is necessary in this part.

    This is also the way I have modified at the moment, I removed the link from PHP code and only output the image options field, this is all.
    A further way should be that it leaves as it is but when “manual“ is choosed it will be included as described.

    Plugin Author Lewis Rosenthal

    (@lewisr)

    I am not sure why the link is related to PHP. The only thing to do is to copy the link with the url parameter ?format=pdf also in the options box

    If you can tell me how to get the url of every post or page which might have a PDF icon on it to create a link without using PHP to query the database, I’m all ears.

    As it stands, we query the database for that information using standard WP classes, called via PHP.

    Alternatively, you could include something in your theme’s functions.php, I suppose, but that would be an all-or-nothing approach, not a per-page or per-post solution.

    Cheers

    Thread Starter nima1

    (@nima1)

    Hello,

    sorry, I do not understand this. The complete topic is related to the predefined link generated by the plugin. The only thing I suggest is to remove the link and only output the input of the options field.

    So instead of the stated link only the options field $this->options[‘imageIcon’] is shown when the option is set to “manual” (not in every cases). In this case the PHP tag has to included as known.

    In this input field the user can paste (or it is set by defaut) also the link.

    Example:
    <a href="?format=pdf">Image or Text or HTML or whatever</a>

    In some cases it is better to state the full link, but this is possible for example with a place holder which is replaced with PHP when the Input field is shown:

    <a href="#pagelink#?format=pdf">Image or Text or HTML or whatever</a>

    At the moment it is not possible for HTML. Is it more clear now?

    Plugin Author Lewis Rosenthal

    (@lewisr)

    Well, you do realize that the above won’t work in all cases, correct? If there already is a ?attribute in the url, then we need &format=pdf, however, I do see now what you want to achieve.

    Okay, let me think on how to best implement this so that it will be useful to a wider audience.

    Thanks for explaining more fully.

    Lewis

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Presentation Options (PDF icon appearance)’ is closed to new replies.