michaelmairegger / Mairegger.Printing

A printing library for WPF
Apache License 2.0
16 stars 4 forks source link

Large amounts of characters don't paginate #7

Closed scionwest closed 8 years ago

scionwest commented 8 years ago

I have the following block of text that comes in from our database that gets stuffed into a model property and i'm adding it to the MyShownObjectLineItem in your example app.


Payment diary for MPT between 9/10/16 to 9/16/16

Location and number of devices are shown below:

McDonald Drive

McDonald Dr. Westbound

1 - "Road Work Ahead" W20-1 (48"x48")
1 - "Street Closed Ahead" W20-104 (48"x48")
1 - "Road Closed" R11-2 (48"x30") 
1 - "Local Traffic Only" Specialty (48"x8")
1 - "Caution: Overhead Power Lines" Specialty (30"x30")

4 - Type 3 Barricades

9 Type A lights
3 rigid stands
2 spring stands

McDonald Dr. Eastbound

1 - "Road Work Ahead" W20-1 (48"x48")
1 - "Street Closed Ahead" W20-104 (48"x48")
1 - "Road Closed" R11-2 (48"x30") 
1 - "Local Traffic Only" Specialty (48"x8")
1 - "Caution: Overhead Power Lines" Specialty (30"x30")
1 - "Mesa Dr. Detour (w/ directional arrow)" Specialty (30"x30")

2 - Type 3 Barricades

10 Type A lights
6 rigid stands
2 spring stands

Mesa Drive

Mesa Dr. Southbound

1 - "Road Work Ahead" W20-1 (48"x48")
1 - "Street Closed Ahead" W20-104 (48"x48")
2 - "Road Closed" R11-2 (48"x30") 
2 - "Local Traffic Only" Specialty (48"x8")
1 - "Caution: Overhead Power Lines" Specialty (30"x30")
1 - "Mesa Dr. Detour (w/ directional arrow)" Specialty (30"x30")

2 - Type 3 Barricades

10 Type A lights
6 rigid stands
2 spring stands

Mesa Dr. Northbound

1 - "Road Work Ahead" W20-1 (48"x48")
1 - "Street Closed Ahead" W20-104 (48"x48")
1 - "Thru Trucks Use Detour" Specialty (48'x48")
1 - "Trucks Use Detour" Specialty (30"x30")
2 - "Road Closed" R11-2 (48"x30") 
2 - "Local Traffic Only" Specialty (48"x8")
1 - "Detour" (Inside Arrow) M4-10L (48"x18")
1 - "Caution: Overhead Power Lines" Specialty (30"x30")
1 - "Mesa Dr. Detour (w/ directional arrow)" Specialty (30"x30")

3 - Type 3 Barricades

18 Type A lights
9 rigid stands
4 spring stands

Alma School Road

Alma School Northbound

2 - "Mesa Dr. Detour (w/ directional arrow)" Specialty (30"x30")

2 Type A light
2 rigid stand

Camelback Road

Camelback Westbound

1 - "Road Work Ahead" W20-1 (48"x48")
4 - "Mesa Dr. Detour (w/ directional arrow)" Specialty (30"x30")

5 Type A lights
1 spring stand
4 rigid stands

Camelback Eastbound

1 - "Road Work Ahead" W20-1 (48"x48")

1 Type A light
1 spring stand

Indian Bend Road

Indian Bend Eastbound 

3 - "Mesa Dr. Detour (w/ directional arrow)" Specialty (30"x30")

3 Type A lights
3 rigid stands

Country Club Road

Country Club Northbound

2 - "Mesa Dr. Detour (w/ directional arrow)" Specialty (30"x30")

2 Type A lights
2 rigid stands

New Signs Added

0

Due to the length of this string, the content needs to wrap onto the next page. A second page is created, but it is blank. I assume this is because WPF knows the content of the control doesn't fit on the 1st page completely, but doesn't render the remaining contents onto the 2nd page.

Is there a way for me to calculate the remaining height on a page, and determine based on the number of characters in my string, splice the string up into multiple IPrintContent instances that can properly span multiple pages?

michaelmairegger commented 8 years ago

Thank you for the feedback. I have pushed new changes to the library. Please use PrintContent.TextLine method to add plain strings. There are also some useful methods in PrintContent class.

But the above stated issue is still present. I will fix that using the StringLineItem class if you use PrintContent.TextLine

For your code do not use MyShownObjectLineItem use PrintContent.TextLine


There are some breaking changes:

scionwest commented 8 years ago

Do you have a version of this already compiled I can get? I'm not able to get this to build because of missing dependencies, such as the JetBrains annotations. I don't have ReSharper, which I think is required for those.

michaelmairegger commented 8 years ago

JetBrains.Annotations should be recovered at build time because of NuGet. You do not need to install ReSharper.

For a comiled version, I will try to resolve #1 as fast as possible.

michaelmairegger commented 8 years ago

You can now find a compiled version of this library on NuGet Mairegger.Printing

scionwest commented 8 years ago

Awesome thanks!