PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed May 23, 2018 6:38 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 18 posts ] 
Author Message
PostPosted: Thu Feb 08, 2018 10:37 am 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 27
Hi !
I have some rows with this parameters:
data_row[index].HeightRule = RowHeightRule.AtLeast;
data_row[index].Height = "15 pt";

big texts take more than 15 pt of row heigh.
If i try data_row[index].Height.ToString() this returns me 15 pt, but how i can get real row height?


Attachments:
tbl.jpg
tbl.jpg [ 91.15 KiB | Viewed 1567 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 11:20 am 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2815
Location: Cologne, Germany
Hi!

You can get the real height from the Renderer after calling PrepareDocument.

Basically there is no real height in MigraDoc, the height is calculated when preparing to create a PDF. The height is not calculated when creating RTF.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 11:45 am 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 27
Hm...but i need this where i prepare document.
if my table more than one page i need to make another page with new section.
may be i can get number of text lines in cell's paragraph and calculate height depending on symbols in paragrah.


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 11:52 am 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2815
Location: Cologne, Germany
pistoletov wrote:
if my table more than one page i need to make another page with new section.
If a MigraDoc table does not fit a single page then it will automatically continue on the next page, but in the same section.

Why do you need a new section?

So maybe create one table at first and prepare the document. If the table needs two pages or more, then create a new document and add the new section/new table manually based on the row dimensions calculated for the first document.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 12:14 pm 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 27
table break is not good. Does any settings to correct this situation?
But table does not go to next page - page 1 of 1..


Attachments:
tbl2.jpg
tbl2.jpg [ 55.16 KiB | Viewed 1561 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 12:21 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2815
Location: Cologne, Germany
pistoletov wrote:
table break is not good.
Then I assume there is something wrong in your code. Maybe you mark all rows as header rows or use KeepWithNext incorrectly.
Tables break to the next page by default - unless you do something wrong.

Are you using class "PdfDocumentRenderer" and method "RenderDocument"?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 12:26 pm 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 27
i use migradoc ddl
...
this.pagePreview = new MigraDoc.Rendering.Forms.DocumentPreview();
......


Document document = gy3.createGy3(new DaoGy3());

// HACK
string ddl = MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToString(document);
this.pagePreview.Ddl = ddl;


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 1:43 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2815
Location: Cologne, Germany
Nothing wrong with the code you are showing here.
Something goes wrong when you add the table to the document. And you don't show that code (not even as an MDDDL file).

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 1:50 pm 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 27
here is pastebin code:
https://pastebin.com/fy6HB4cm

from 79 line making header of table
in 141 line add cells with data drom DataTable

And one more question - does it possible to show in document preview all pages and scroll it up-down using mouse wheel?
Now i see only one page and change pages using this.pagePreview.NextPage(); and srolling page using vertical scroll bar


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 2:02 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2815
Location: Cologne, Germany
pistoletov wrote:
And one more question - does it possible to show in document preview all pages and scroll it up-down using mouse wheel?
Yes - if the mouse cursor is not over any text.

You show just a code snippet - nothing's obviously wrong with the code showing.
If you think there is a bug with MigraDoc, please provide a solution:
http://www.pdfsharp.net/wiki/IssueSubmissions.ashx

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 2:21 pm 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 27
thank you, Thomas.
I can submit my full project. It based on the DocumentViewer project from examples.
Where i can send this project?
Artem


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 2:34 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2815
Location: Cologne, Germany
pistoletov wrote:
I can submit my full project.
MCVE stand for a Minimal, Complete, and Verifiable Example.
I don't need a "full project" that does not run without a database or such.

If it is smaller than 250 kiB (and it should be - at least after deleting the NuGet packages) you can attach it to a post on the forum.

Weekend starts in 30 minutes. I'll be back at work on Tuesday.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 2:53 pm 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 27
No need db connection.
I make a dao class from dummy data for test purpose.
The project is tiny.
Have a nice weekends!


Attachments:
DocumentViewer.rar [29.39 KiB]
Downloaded 42 times
Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 3:02 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2815
Location: Cologne, Germany
I get an error message:
---------------------------
WinZip
---------------------------
Error: "[...]\DocumentViewer.rar" is not a valid RAR file.
---------------------------
OK Help
---------------------------

I prefer ZIP files.
I will try again on Tuesday.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 09, 2018 10:57 am 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 27
ok!
i recompress in zip


Attachments:
DocumentViewer.zip [30.33 KiB]
Downloaded 40 times
Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 15, 2018 9:58 am 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 27
Hi, Thomas!
Does the new archive ok for test table bug?


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 15, 2018 4:41 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2815
Location: Cologne, Germany
pistoletov wrote:
Does the new archive ok for test table bug?
Extracting works, thanks for that. The linked files for HelloMigraDoc are missing, so it does not compile.
Sorry, but I have to give up for today. Have to do some tasks I get paid for.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 17, 2018 11:55 am 
Offline

Joined: Tue Aug 15, 2017 11:27 am
Posts: 27
Hi Thomas. You can remove HelloMigradoc files.
Bugs occures in DocumentViewer project.
Here 2 classes: DAOgy3 (generate some data for document) and gy3 (migradoc preparing document ).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group