iTextSharp: “The document has no pages” when using ColumnTextImages in PDF files problem for ServletOutputStreamiTextSharp How include GenericTag using XML ParsingHow to resize a PdfPTable to fit the page?Using Bootstrap Glyph icons in iTextSharpAdding an attachment to existing PDF file using iTextSharpto trim page's whitespace using itextpdfiText(Sharp) - how to avoid creating a blank page?Create PDF with iText on iSeries leads to error “The document has no pages.”ITextSharp adding direct content bar code change font color for paragraphsCannot parse hebrew HTML file to pdf with itextsharp

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

Why doesn't H₄O²⁺ exist?

Does object always see its latest internal state irrespective of thread?

How does one intimidate enemies without having the capacity for violence?

How much RAM could one put in a typical 80386 setup?

Can a monk's single staff be considered dual wielded, as per the Dual Wielder feat?

Why can't we play rap on piano?

Filter any system log file by date or date range

Can a Cauchy sequence converge for one metric while not converging for another?

Java Casting: Java 11 throws LambdaConversionException while 1.8 does not

Rock identification in KY

Unable to deploy metadata from Partner Developer scratch org because of extra fields

Why is 150k or 200k jobs considered good when there's 300k+ births a month?

Has there ever been an airliner design involving reducing generator load by installing solar panels?

Is it inappropriate for a student to attend their mentor's dissertation defense?

Convert two switches to a dual stack, and add outlet - possible here?

"You are your self first supporter", a more proper way to say it

Arrow those variables!

Languages that we cannot (dis)prove to be Context-Free

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?

Two films in a tank, only one comes out with a development error – why?

How do I deal with an unproductive colleague in a small company?

How to source a part of a file

How to move a thin line with the black arrow in Illustrator?



iTextSharp: “The document has no pages” when using ColumnText


Images in PDF files problem for ServletOutputStreamiTextSharp How include GenericTag using XML ParsingHow to resize a PdfPTable to fit the page?Using Bootstrap Glyph icons in iTextSharpAdding an attachment to existing PDF file using iTextSharpto trim page's whitespace using itextpdfiText(Sharp) - how to avoid creating a blank page?Create PDF with iText on iSeries leads to error “The document has no pages.”ITextSharp adding direct content bar code change font color for paragraphsCannot parse hebrew HTML file to pdf with itextsharp






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















The following code throws "The document has no pages"



using (var stream = new MemoryStream())

using (var document = new Document())

document.SetPageSize(PageSize.LETTER);

using (var pdfWriter = PdfWriter.GetInstance(document, stream))

document.Open();

PdfContentByte pdfContentByte = pdfWriter.DirectContent;

ColumnText columnText = new ColumnText(pdfContentByte);
columnText.SetSimpleColumn(0, 0, 100, 20);
columnText.AddElement(new Paragraph("Sample text", new Font(Font.FontFamily.HELVETICA, 20)));
columnText.Go();

document.Close();



byte[] pdfBytes = stream.ToArray();

// ...



How am I supposed to use ColumnText and DirectContent if this is not the way to do it?



I'm using iTextSharp 5.5.3










share|improve this question






















  • Have you checked the return value of columnText.Go()? And have you tried with a more loosely fitting column?

    – mkl
    Mar 22 at 6:45











  • I will try both @mkl

    – sports
    Mar 22 at 16:21











  • Indeed it seems I needed a moer loosely fitting column....

    – sports
    Mar 22 at 16:40

















0















The following code throws "The document has no pages"



using (var stream = new MemoryStream())

using (var document = new Document())

document.SetPageSize(PageSize.LETTER);

using (var pdfWriter = PdfWriter.GetInstance(document, stream))

document.Open();

PdfContentByte pdfContentByte = pdfWriter.DirectContent;

ColumnText columnText = new ColumnText(pdfContentByte);
columnText.SetSimpleColumn(0, 0, 100, 20);
columnText.AddElement(new Paragraph("Sample text", new Font(Font.FontFamily.HELVETICA, 20)));
columnText.Go();

document.Close();



byte[] pdfBytes = stream.ToArray();

// ...



How am I supposed to use ColumnText and DirectContent if this is not the way to do it?



I'm using iTextSharp 5.5.3










share|improve this question






















  • Have you checked the return value of columnText.Go()? And have you tried with a more loosely fitting column?

    – mkl
    Mar 22 at 6:45











  • I will try both @mkl

    – sports
    Mar 22 at 16:21











  • Indeed it seems I needed a moer loosely fitting column....

    – sports
    Mar 22 at 16:40













0












0








0








The following code throws "The document has no pages"



using (var stream = new MemoryStream())

using (var document = new Document())

document.SetPageSize(PageSize.LETTER);

using (var pdfWriter = PdfWriter.GetInstance(document, stream))

document.Open();

PdfContentByte pdfContentByte = pdfWriter.DirectContent;

ColumnText columnText = new ColumnText(pdfContentByte);
columnText.SetSimpleColumn(0, 0, 100, 20);
columnText.AddElement(new Paragraph("Sample text", new Font(Font.FontFamily.HELVETICA, 20)));
columnText.Go();

document.Close();



byte[] pdfBytes = stream.ToArray();

// ...



How am I supposed to use ColumnText and DirectContent if this is not the way to do it?



I'm using iTextSharp 5.5.3










share|improve this question














The following code throws "The document has no pages"



using (var stream = new MemoryStream())

using (var document = new Document())

document.SetPageSize(PageSize.LETTER);

using (var pdfWriter = PdfWriter.GetInstance(document, stream))

document.Open();

PdfContentByte pdfContentByte = pdfWriter.DirectContent;

ColumnText columnText = new ColumnText(pdfContentByte);
columnText.SetSimpleColumn(0, 0, 100, 20);
columnText.AddElement(new Paragraph("Sample text", new Font(Font.FontFamily.HELVETICA, 20)));
columnText.Go();

document.Close();



byte[] pdfBytes = stream.ToArray();

// ...



How am I supposed to use ColumnText and DirectContent if this is not the way to do it?



I'm using iTextSharp 5.5.3







itext






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 21 at 22:47









sportssports

2,914104893




2,914104893












  • Have you checked the return value of columnText.Go()? And have you tried with a more loosely fitting column?

    – mkl
    Mar 22 at 6:45











  • I will try both @mkl

    – sports
    Mar 22 at 16:21











  • Indeed it seems I needed a moer loosely fitting column....

    – sports
    Mar 22 at 16:40

















  • Have you checked the return value of columnText.Go()? And have you tried with a more loosely fitting column?

    – mkl
    Mar 22 at 6:45











  • I will try both @mkl

    – sports
    Mar 22 at 16:21











  • Indeed it seems I needed a moer loosely fitting column....

    – sports
    Mar 22 at 16:40
















Have you checked the return value of columnText.Go()? And have you tried with a more loosely fitting column?

– mkl
Mar 22 at 6:45





Have you checked the return value of columnText.Go()? And have you tried with a more loosely fitting column?

– mkl
Mar 22 at 6:45













I will try both @mkl

– sports
Mar 22 at 16:21





I will try both @mkl

– sports
Mar 22 at 16:21













Indeed it seems I needed a moer loosely fitting column....

– sports
Mar 22 at 16:40





Indeed it seems I needed a moer loosely fitting column....

– sports
Mar 22 at 16:40












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290366%2fitextsharp-the-document-has-no-pages-when-using-columntext%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290366%2fitextsharp-the-document-has-no-pages-when-using-columntext%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript