Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9053267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:23:02+00:00 2026-06-16T13:23:02+00:00

I’m trying to create a header with an image; the header is added, but

  • 0

I’m trying to create a header with an image; the header is added, but the image is missing in header. My application is deployed on an Oracle Weblogic server (using Java EE and Hibernate).

I’m trying to create the image like this. getImage(seasonalFilter.getPictureFileId()).getAbsolutePath(). The image path is something like this: /tmp/6461346546165461313_65464.jpg.

Note that I want to add text under the image in the header (for every page).

public File convertHtmlToPdf(String JSONString, ExportQueryTypeDTO queryType, String htmlText, ExportTypeDTO type) throws VedStatException {
    try {
      File retFile = null;
      FilterDTO filter = null;
      HashMap<Object, Object> properties = new HashMap<Object, Object>(queryType.getHashMap());
      filter = JSONCoder.decodeSeasonalFilterDTO(JSONString);
      DateFormat formatter = new SimpleDateFormat("yyyy_MM_dd__HH_mm");
      //logger.debug("<<<<<<   HTML TEXT: " + htmlText + " >>>>>>>>>>>>>>>>");
      StringBuilder tmpFileName = new StringBuilder();
      tmpFileName.append(formatter.format(new Date()));
      retFile = File.createTempFile(tmpFileName.toString(), type.getSuffix());
      OutputStream out = new FileOutputStream(retFile);
      com.lowagie.text.Document document = new com.lowagie.text.Document(com.lowagie.text.PageSize.LETTER);
      com.lowagie.text.pdf.PdfWriter pdfWriter = com.lowagie.text.pdf.PdfWriter.getInstance(document, out);
      document.open();
      com.lowagie.text.html.simpleparser.HTMLWorker htmlWorker = new com.lowagie.text.html.simpleparser.HTMLWorker(document);
      String str = htmlText.replaceAll("ű", "&ucirc;").replaceAll("ő", "&otilde;").replaceAll("Ő", "&Otilde;").replaceAll("Ű", "&Ucirc;");
      htmlWorker.parse(new StringReader(str));
      if (filter instanceof SeasonalFilterDTO) {
        SeasonalFilterDTO seasonalFilter = (SeasonalFilterDTO) filter;
        if (seasonalFilter.getPictureFileId() != null) {
          logger.debug("Image absolutePath: " + getImage(seasonalFilter.getPictureFileId()).getAbsolutePath());
          Image logo = Image.getInstance(getImage(seasonalFilter.getPictureFileId()).getAbsolutePath());
          logo.setAlignment(Image.MIDDLE);
          logo.setAbsolutePosition(0, 0);
          logo.scalePercent(100);
          Chunk chunk = new Chunk(logo, 0, 0);
          HeaderFooter header = new HeaderFooter(new Phrase(chunk), true);
          header.setBorder(Rectangle.NO_BORDER);
          document.setHeader(header);
        }
      }
      document.close();

      return retFile;
    } catch (Exception e) {
      throw new VedStatException(e);
    }

  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:23:03+00:00Added an answer on June 16, 2026 at 1:23 pm

    I really dislike your false allegation that “Every tutorial is based on C:\imagelocation\dsadsa.jpg”

    I’m the author of two books and many tutorials about iText and I know for a fact that what you say doesn’t make any sense. Take a look at my name: “Bruno Lowagie.” You are using my name in your code, so please believe me when I say you’re doing it completely wrong.

    Instead of HTMLWorker, you should use XML Worker. HTMLWorker is no longer supported and will probably be removed from iText in the near future.

    I see that you’re also using the HeaderFooter class. This class has been removed several years ago. Please take a look at the newer examples: http://www.itextpdf.com/themes/keyword.php?id=221

    These examples are written in Java; if you need the C# version, please look for the corresponding C# examples in the SVN repository.

    Regarding images, you may want to read chapter 10 of my book.

    Finally: please read http://lowagie.com/itext2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
Basically, what I'm trying to create is a page of div tags, each has
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.