Giter VIP home page Giter VIP logo

htmlviewer's Introduction

--------------------------------------------------------------------------------
Welcome to GitHub!
--------------------------------------------------------------------------------

Developers might want to use Tortoise-GIT or "Git Gui" to keep their sources up-to-date.

Or even become a member of GitHub, clone the repository and push their changes 
to their clone. If they are of public interest you can request me to pull it 
into my branch where it will become part of the "official" HtmlViewer.

--------------------------------------------------------------------------------
HtmlViewer 11
--------------------------------------------------------------------------------

The current version is HtmlViewer 11.10 in the default branch "HtmlViewer-11.10".
The next version is growing up in branch "master".

The HtmlViewer component set consists of the THtmlViewer, TFrameViewer,
and TFrameBrowser components. All three are HTML document display components:

THtmlViewer
- The basic component.
- THtmlViewer displays single (non-frame) documents from file systems and resources.
- It also forms the basis for the other two components.

TFrameViewer 
- Displays both frame and single HTML documents.
- TFrameViewer is oriented more for local file system use.

TFrameBrowser
- Also displays frame and single HTML documents.
- TFrameBrower is oriented for use with local file systems and toward Internet
  style protocols and URL usage.
- Additional code and/or components are generally required to get data from other
  sources than the local file system. We recommend using Indy or ICS components.

These components support most of the HTML 4.01 specifications 
with many additional popular HTML 5 enhancements.
Many Cascading Style Sheet properties are also supported.

Some features:
- Cascading Stylesheets
- Large HTML files
- HTML Frames
- HTML Forms
- HTML Tables
- Bitmap, GIF, JPEG, and PNG Images
- Transparent images
- Image caching
- Left and right floating images
- Image sizing attributes
- Client side image maps
- Background colors and images
- Font sizes, styles, and colors with HTML tags or default settings
- Formatted printing of the HTML document
- Can print multiple pages horizontally
- Print preview
- Text search
- Copy to clipboard
- Subscripts and superscripts
- Unicode, UTF-8 and many single and multi byte character codes supported
- DPI scaling
- works with Delphi  2009   or newer, 32 and 64 Bit
- works with Lazarus 1.2.x  or newer, 32 and 64 Bit, for Windows and Linux 

While HTML documents are normally associated with the Internet, they are also
very useful for displaying all kinds of textual material such as documentation,
helpfiles, etc. Graphics are easily incorporated in these documents.

For a detailed list and demonstration of features start FrameDem.exe and try 
some other demo programs.

For a detailed list of changes and bugfixes per version start FrameDem.exe 
and click "What's new" or see "./Demos/Compiled Framedemo/whatsnew.htm".

--------------------------------------------------------------------------------
HtmlViewer 11.x is available at: https://sourceforge.net/projects/htmlviewer/
HtmlViewer development is hosted at: https://github.com/BerndGabriel/HtmlViewer
--------------------------------------------------------------------------------

If you try to use HtmlViewer 11 with no longer supported Delphi 6..2007 you 
will need the TntUnicodeControls 2.3.0 or 2.2.1, which are available at:

http://www.yunqa.de/delphi/doku.php/products/tntunicodecontrols/index

Please install them into your IDE.

--------------------------------------------------------
Copyright (c) 1995 - 2008 by L. David Baldwin
Copyright (c) 1995 - 2023 by Anders Melander (DitherUnit.pas)
Copyright (c) 1995 - 2023 by Ron Collins (HtmlGif1.pas)
Copyright (c) 2008 - 2009 by Sebastian Zierer (Delphi 2009 Port)
Copyright (c) 2008 - 2010 by Arvid Winkelsdorf (Fixes)
Copyright (c) 2009 - 2023 by HtmlViewer Team 

See included License.txt
--------------------------------------------------------------------------------

htmlviewer's People

Contributors

alexey-t avatar berndgabriel avatar ccy avatar danielpaepke avatar domenicomammola avatar fr0st-brutal avatar jnachbar avatar jpetermugaas avatar kbickar avatar landrix avatar magsys avatar martinsedgewick avatar michaelvanham avatar plpolak avatar popre avatar temoi avatar zacglenn avatar zencode1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

htmlviewer's Issues

Unicode not displayed correctly

Hi, the following are not display correctly:
ā ṭ “ ” ñ
shown as respectively below:
Ä á¹ â€œ â€� ñ

would be great if these problem are solved.

Thanks.

Brad.

The problem for Delphi 7

THTMLViewer trying to install a component for Delphi 7

TntUnicodeControls 2.3.0 component installed successfully.

If you are installing THTViewer get an exception

"[Error] TntWideStrings.pas (353): Undeclared identifier: 'WideLoadResString'"

procedure TWideStrings.Error(Msg: PResStringRec; Data: Integer);
begin
Error(WideLoadResString(Msg), Data); --> here to crashes
end;

Regards

Packages for Delphi 10 Seattle and updated ICS demo

I've made changes to support Delphi 10 Seattle and created the packages.

Also made several improvements to the FrameBrowserUsingICSv7 demo to properly support http/1.1, better authentication and form posting. Sorry, another ICS contributor reformatted some units with the XE2 style formatter which makes merging almost impossible.

I've used Hithub in the past and found in tedious to submit changes and don't have the time to do so again, so all the changed files are at:
http://www.magsys.co.uk/download/software/htmlview-11.6-7-magsys.zip

Angus

Wow - cool thing

Hi there,

your htmlviewer is the perfect backoffice counterpart for webfrontends using ckeditor.
It renders all embedded images
img alt="" src="data:image/jpeg;base64,"...."
img alt="" src="data:image/png;base64,"...."
img src="data:image/bmp;base64,"...." alt=""
img src="data:image/gif;base64,"...." alt=""

web

But it fails on icons
img alt="" src="data:image/x-icon;base64,"...."
win

Would it be much work to implement them ?

rgds
Ralph

Reduce redundant coordinate calculations

Lots of calculations done in DrawLogic methods are repeated in the Draw methods.

DrawLogic ought to be the method, that precalculates the entire layout and Draw should not re-evaluate a single coordinate, but draw, what DrawLogic has calculated. Only viewport calculations might be done in Draw.

Blocks should remember inner and outer rectangles relative to parent.
Texts should remember the lists of their LineRecs.

Delphi XE2 Support

Hello,

I'm a new git on the block. ;-)

I'd like to know if you're working on a version of HtmlViewer for XE2?

I've managed to install the components in 32-bit mode, but the 64-bit compiler is complaining about a couple of asm-procedures.

In "DitherUnit.pas": ByteSwapColors
In "HtmlUn2.pas": StrLenW, StrPosW, StrRScanW and StrScanW

I don't know any assembler, or I would have translated them into pascal code myself. Do you know any Delphi procedures that can be used instead? Otherwise, when you have time I'd appreciate pascal versions of them, at least the ones in "HtmlUn2.pas" cause ByteSwapColors can be avoided by not defining PIXELFORMAT_TOO_SLOW.

Have a lovely day!
Thanks for reading. :-)

Incorrect displays

HTMLViewer 11.5

The html code from the "attached" emails does not display correctly.

BoS - the images are loaded by my app but do not display
Becky - the disclaimer in light text should be at the bottom
Office - screwed - layout and images

Sorry about pasting the html into the text but its the only way I can find to get it to you. Attachments don't seem to work.

BECKY

<title>FW: Compare keyman cover</title><style type="text/css">body, #bodyTable { height:100% !important; width:100% !important; margin:0; padding:0; }table, td {border-collapse:collapse; }table, td {mso-table-lspace:0pt; mso-table-rspace:0pt;}img{-ms-interpolation-mode: bicubic; text-decoration:none; border:0 none; line-height:100%;}body, table, td, p, a, li, blockquote{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}td img { display: block; }a.disable-link { pointer-events: none; cursor: default;}a.nav{color:#ffffff;}a.nav:hover {color:#7ac142;} .table {width:600px !important;max-width:600px !important;margin-left:auto !important;margin-right:auto !important;}@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {body[yahoo] .click {display: none !important; max-height: 0 !important;}body[yahoo] .tap:after {content:"tap";}@media screen and (max-device-width: 480px), screen and (max-width: 480px) {body[yahoo] body, body[yahoo] td, body[yahoo] p, body[yahoo] a, body[yahoo] li, body[yahoo] blockquote{-ms-text-size-adjust:110% !important; -webkit-text-size-adjust:110% !important;}body[yahoo] .click {display: none; display: none !important; max-height: 0 !important;}body[yahoo] .tap:after {content:"tap";}body[yahoo] .table {width:100% !important;max-width:100% !important;max-device-width:100% !important;}body[yahoo] td {width:100% !important;float:left !important;margin-left: 0px !important;margin-right: 0px !important;max-device-width:100% !important;max-width:100% !important;}body[yahoo] img {width:100% !important;height:auto !important;max-width:100% !important;max-device-width:100% !important;margin-bottom:0px !important;display:block !important;}body[yahoo] a[class="disable-link"] { pointer-events: auto !important; cursor: auto !important;}body[yahoo] .hideelement {display:none !important;}}</style>

Hi Roy,

Further to my recent email, have you protected against the financial effects of death, terminal or critical illness?

Key Man insurance is your businesses financial lifeline. Providing essential funds when they're most needed. The loss of a key person from your business can result in:

•  Reduced sales
•  Loss of profit
•  Reduced turnover

With a business protection policy, you can create a plan that enables your business to not only survive, but to thrive, even without your key person's vital knowledge or generated profits.

Don't hesitate to contact us if you would like to find out more information about Key Man insurance. One of our FCA regulated advisers would be happy to provide you with further information along with a personalised quote, simply complete our online enquiry form.

For our online form - click here

Kind regards,

Michael

This email was sent to you by Merrehill Ltd registered office:
Military House, 24 Castle Street, Chester, Cheshire, CH1 2DS
Registered in England and Wales 05518204.

Business Protection Expert Ltd is an appointed representative of Openwork Limited
which is authorised and regulated by the Financial Conduct Authority.

The content of this website does not constitute financial advice and is provided for general information purposes only. We take care to make sure that the information and material appearing on this website is accurate and up-to-date. However, errors and omissions may occur and you should not take the accuracy of the information and material for granted or rely upon it as a statement or representation of fact.

You can use this link to be excluded from getting further emails of ours.

BOS

<title>Bank of Scotland</title><style type="text/css"> table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; } body { margin:0 !important; padding:0 !important; }@media screen and (max-width: 720px) { /\* mobile-specific CSS styles go here _/img[class="logo"] { padding-left:20px !important; }.mobilehide {display:none !important; } table[class="contenttable"] { width:325px !important; }td[class="leftmargin"] { width:15px !Important; }td[class="rightmargin"] { width:10px !Important; }.mainwidth { width:300px !important; }.mainwidthcentre { width:300px !important; text-align:center !important; }.socialwidth { width:200px !important; margin-top:5px; margin-bottom:5px; margin-left:5px;}.socialwidth2 { width:90px !important; padding:3px;}.introwidth { width:275px !important; }.introwidthandmargin { width:275px !important; margin-bottom:20px;}.marginbottom {margin-bottom:10px;}td[class="anchorwidth"] { width:323px !Important;}.anchors {width:270px !important; padding-left:0px !important; font-size:15px !important; line-height:23px;}.anchorsbgcolor {background-color:##007f7b !important;}.anchorlineheight {line-height:17px !important;}.cta {width:250px !important;}.ctaandheight {width:275px !important; height:25px !important;}.buttonsize {width:125px !important; height:30px !important; font-size:14px !important;}.centre {text-align:center !important }.heightnone {height:1px !important; line-height:1px !important; font-size:1px !important;}.buttonsize {width:125px !important; height:30px !important; font-size:14px !important;}.buttonsize {width:125px !important; height:30px !important; font-size:14px !important;}</style>
  BUSINESS BANKING - Practical tools from the Business Bank of the Year.  Web version | Text Version  
  Bank of Scotland
 
 


Dear Roy

Hard work and innovative ideas will help you drive your business forward with confidence. Having the right guidance can also make a difference.

To support your growth, we have a range of online tools and guides, including SWOT analysis and understanding your market. It’s part of our determination to be the best bank for Scottish businesses like yours – a commitment that saw us voted Business Bank of the Year earlier in 2015_.

We’ll be in contact soon with more practical business support.





 
Growing your business?
Grow it with confidence.





Discover your strengths, weaknesses, opportunities and threats to business growth with our SWOT analysis guide.

Read more


 
 
 
Understanding your customers’ needs,
or needing customers?




 Our guide to understanding your market helps you respond to your customers’ needs while understanding gaps in your competitors’ service.

Take a look


 
 
 

*FDs' Excellence Awards in association with ICAEW and supported by the CBI & Real Business. Business Bank of the Year was won in 2015 by Lloyds Banking Group plc which includes operating subsidiaries Lloyds Bank plc and Bank of Scotland plc.

 

 
 
Go online to find out how you can benefit from a seamless, seven day switch to Bank of Scotland.
 
     
 
 
Find us on LinkedIn
Join our discussion group

 
     


Unsubscribe View our privacy policy


Share this email
  Twitter LinkedIn
  Facebook      Google+


     
 

Security Information
Please note that Bank of Scotland NEVER send emails that ask for confidential or security information. We’ll never send you an email asking for your log on details, or direct you to a webpage that asks for this information. Visit our online security pages for more details. Please note that any data sent via e-mail is not secure and could be read by others.

Unsubscribe
If you wish to unsubscribe from marketing messages sent by email from Bank of Scotland plc, please click here to unsubscribe.

Privacy Policy
View our Privacy Policy

Our service promise
If you experience a problem, we will always try to resolve it as quickly as possible. Please bring it to the attention of any member of staff. Our complaints procedures are published at bankofscotlandbusiness.co.uk/get-in-touch/

If you have a hearing or speech impairment you can use Text Relay (previously Typetalk).

Bank of Scotland plc Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland no. SC327000. Authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and the Prudential Regulation Authority under Registration Number 169628.

The Lloyds Banking Group includes companies using brands including Lloyds Bank, Halifax and Bank of Scotland and their associated companies. More information on the Lloyds Banking Group can be found at lloydsbankinggroup.com.

Eligible deposits with us are protected by the Financial Services Compensation Scheme (FSCS). We are covered by the Financial Ombudsman Service (FOS). Please note that due to FSCS and FOS eligibility criteria not all Business customers will be covered.

 
     

 

OFFICE

<title>Acan Business Park</title><style type="text/css" media="screen">\* {line-height: inherit;}.ExternalClass \* { line-height: 100%; }body, p{margin:0; padding:0; margin-bottom:0; -webkit-text-size-adjust:none; -ms-text-size-adjust:none;} img{line-height:100%; outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;} a img{border: none;} #backgroundTable {margin:0; padding:0; width:100% !important; } a, a:link, .no-detect-local a, .appleLinks a{color:#5555ff !important; text-decoration: underline;} .ExternalClass {display: block !important; width:100%;} .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: inherit; } table td {border-collapse:collapse;mso-table-lspace: 0pt; mso-table-rspace: 0pt;} sup{position: relative; top: 4px; line-height:7px !important;font-size:11px !important;} .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {text-decoration: default; color: #5555ff !important; pointer-events: auto; cursor: default;} .no-detect a{text-decoration: none; color: #5555ff; pointer-events: auto; cursor: default;} {color: #5555ff;} span {color: inherit; border-bottom: none;} span:hover { background-color: transparent; }.nounderline {text-decoration: none !important;}h1, h2, h3 { margin:0; padding:0; }p {Margin: 0px !important; }table[class="email-root-wrapper"] { width: 600px !important; }body {}body { min-width: 280px; width: 100%;}td[class="pattern"] .c412p71r { width: 71.1864406779661%;}td[class="pattern"] .c167p28r { width: 28.813559322033896%;}</style><style>@media only screen and (min-width: 600px) { td[class="pattern"] .c412p71r { width: 412px !important;}td[class="pattern"] .c167p28r { width: 167px !important;}}@media only screen and (max-width: 599px),only screen and (max-device-width: 599px),only screen and (max-width: 400px),only screen and (max-device-width: 400px) { .email-root-wrapper { width: 100% !important; } table[class="email-root-wrapper"] { width: 100% !important; } td[class="wrap"] .full-width { width: 100% !important; height: auto !important;} td[class="wrap"] .fullwidthhalfleft {width:100% !important;} td[class="wrap"] .fullwidthhalfright {width:100% !important;} td[class="wrap"] .fullwidthhalfinner {width:100% !important; margin: 0 auto !important; float: none !important; margin-left: auto !important; margin-right: auto !important; clear:both !important; } td[class="wrap"] .hide { display:none !important; width:0px;height:0px; overflow:hidden; } td[class="pattern"] .c412p71r { width: 100% !important; }td[class="pattern"] .c167p28r { width: 100% !important; }}@media yahoo{table {table-layout:fixed;float: none !important;height:auto; }table[align="left"] {float:left !important; }td[align="left"] {float:left !important;height:auto; }table[align="center"] {margin:0 auto; }td[align="center"] {margin:0 auto;height:auto; }table[align="right"] {float:right !important; }td[align="right"] {float:right !important;height:auto; }}@media only screen and (max-width: 599px),only screen and (max-device-width: 599px),only screen and (max-width: 400px),only screen and (max-device-width: 400px){table[class=desktop-hide] { display: table !important; height: auto !important; max-height: 100% !important; width: 100% !important; line-height: auto !important;}}@media only screen and (min-width: 600px){\* [lang~='dHide']{ display:NONE!important; height:0; max-height:0; width:0; max-height:0; overflow:hidden; }}@media yahoo {table.desktop-hide { display: none !important; width: 0px !important; height:0px !important; }}</style><STYLE type="text/css" media="(pointer) and (min-color-index:0)">html, body {background-image: none !important; background-color: transparent !important; margin:0 !important; padding:0 !important;}</STYLE>
Can't see this email..? Click here to view in your browser.

FOR SALE

INDUSTRIAL UNIT WITH OFFICES

Modern build constructed in the early 2000s 

12,364 sq ft (1,149 sq m)

Acan Business Park, Garrard Way, Kettering, NN16 8TD

Property Overview

One mile from Junction 7 of the A14

Secure rear yard and car parking for approx. 12 cars

B1, B2 and B8 planning permission

Click here for more information...
BNP Paribas | 0121 237 1234
If you wish to unsubscribe, please click on the link below.
Please note this is an automated operation.
Click here to unsubscribe

Free on an Freed Object

after this call

mfp := TMetaFilePrinter.Create(self);
html.PrintPreview(mfp);

the application crash.

i located the problem at

procedure ThtDocument.Clear;
... inherited Clear; //(self.Count = 1)
and
procedure TFreeList.Notify(Ptr: Pointer; Action: TListNotification);

as a workarround, this helps:

procedure TFreeList.Notify(Ptr: Pointer; Action: TListNotification);
begin
if (Action = lnDeleted) and FOwnsObjects then
if TObject(Ptr).ClassName <> 'TFreedObject' then
TObject(Ptr).Free;
end;

Print Preview Error

Reported by [email protected], Mar 13, 2015
Which steps will reproduce the problem?

  1. locate "HtmlViewer\Demos\Main Demos"
  2. open "HtmlDemoW.dpr" and run
  3. press F3 or "File > Open" click and load attached 28983001As_Data.htm files or other html files
  4. File > Print Preview... click

What is the expected output? What do you see instead?
The printout should arrive, "Invalid Pointer Operation" Error

Which version of the product are you using? Which compiler version are you
using? On which operating system?
w8.1 - xe3 - THtmlViewer-115-r472

Please attach test html files and screenshots, if appropriate.
Please provide any additional information:

excuse me, i have bad english ...

example file:
https://thtmlviewer.googlecode.com/issues/attachment?aid=4050000000&name=Invalid+Pointer+Op+Metarials.zip&token=ABZ6GAflMhcYNEnSIPYqcmB2CPfYE46eTw%3A1428022673283

Access Violation when calling LoadFromString

The function "LoadFromString" is called with a string and the following access violation was reported:

exception class    : EAccessViolation
exception message  : Access violation at address 00408F08 in module 'Program.exe'. Read of address FFFFFFFD.
00408f08 +008 Program.exe System           15513  +1 TObject.Free
007fd493 +01f Program.exe StyleUn           3014  +2 TStyleList.Clear
008330ff +0eb Program.exe HTMLSubs          7104 +24 ThtDocument.Clear
00863cd9 +05d Program.exe HtmlView          4402  +8 THtmlViewer.InitLoad
0085cba9 +1e1 Program.exe HtmlView          1229 +56 THtmlViewer.LoadDocument
0085cf82 +036 Program.exe HtmlView          1297  +3 THtmlViewer.LoadString
0085c9b5 +009 Program.exe HtmlView          1156  +1 THtmlViewer.LoadFromString

Focus loss after document load

When clicking a link, ParentForm.ActiveControl is changed to a some TabControl (currently I can't understand what it is). If URLAction is handled, the contents of HTMLViewer is changed (except for cases when the link is an anchor to the same page) and TabControl goes away, therefore ActiveControl becomes NIL what is unlikely a good thing.
Besides bad look it also leads to inconvenience when user cannot use mouse wheel immediately - he has to click a html view explicitly.

EDIT: the quick fix suggested was bad

GIF transparency inverted + memory leak

Transparent GIF images are displayed with inverted colors and cause a memory leak.

The problem was introduced by check-in bc29d97 on 17.06.2015 21:59:15.

To reproduce, open the HTML below with in HtmlDemo.exe so it loads transparent.gif:

<html>
<head>
</head>
<body>
<img src=transparent.gif>
</body>
</html>

transparent

To solve, I propose the following patch below against 00056eb. It works well for me and HtmlViewer\Demos\Compiled Framedemo\sample3.htm shows no obvious side effects.

--- a/source/HtmlImages.pas
+++ b/source/HtmlImages.pas
@@ -633,7 +633,7 @@ begin
       if Bitmap <> nil then
       begin
         //if Transparent = LLCorner then
-          Mask := GetImageMask(Bitmap, False, 0);
+          // Yunqa.de removed: Mask := GetImageMask(Bitmap, False, 0);
         Bitmap := ConvertImage(Bitmap);
         Result := ThtBitmapImage.Create(Bitmap, Mask, Transparent);
       end;

--- a/source/HTMLSubs.pas
+++ b/source/HTMLSubs.pas
@@ -2866,7 +2866,7 @@ begin
     H := ObjHeight;
   end;
   try
-    ddImage.Transp := Transparent;
+    // Yunqa removed: ddImage.Transp := Transparent;
     if IsCopy then
       ddImage.Print(Canvas, XX, Y, W, H, clWhite)
     else

Ralf

Problem with the "lang" attribute in the link

THtmlViewer distorts the link containing the lang attribute:

The link:

http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Femployment%2Femployment_relations%2Farticle%2Fholidays_calend&lang=ru

it will be transformed in (the lang attribute disappears):

http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Femployment%2Femployment_relations%2Farticle%2Fholidays_calend=ru

How to check:

1 . Create a HTML document with the contents:

<html>
<body>
<a href="http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Femployment%2Femployment_relations%2Farticle%2Fholidays_calend&lang=ru
">Holidays 2013</a>
</body>
</html>

2 . Open this document through FrameDem.exe (Demos\Compiled Framedemo).
3 . Follow the link.

Incorrect functions htLowerCase, htUpperCase in unicode version Delphi

In unicode version of Delphi to change the character case need to use functions AnsiLowerCase, AnsiUpperCase instead of LowerCase, UpperCase.

http://docwiki.embarcadero.com/Libraries/XE2/en/System.AnsiStrings.LowerCase

function htLowerCase(Str: ThtString): ThtString;
begin
  {$ifdef UNICODE}
    // Result := LowerCase(Str);
    Result := AnsiLowerCase(Str);
  {$else}
    Result := Str;
    if Length(Result) > 0 then
      CharLowerBuffW(@Result[1], Length(Result));
  {$endif}
end;
function htUpperCase(Str: ThtString): ThtString;
begin
  {$ifdef UNICODE}
    // Result := UpperCase(Str);
    Result := AnsiUpperCase(Str);
  {$else}
    Result := Str;
    if Length(Result) > 0 then
      CharUpperBuffW(@Result[1], Length(Result));
  {$endif}
end;

Weird scrollbar rendering with double-buffered parent and themes

Copied from https://code.google.com/p/thtmlviewer/issues/detail?id=206 as the issue still exists

Which steps will reproduce the problem?

  1. Create a form with a THTMLViewer and a TXPManifest.
  2. For the form, set DoubleBuffered:=TRUE.
  3. In OnCreate, fill the THTMLViewer with text, so that a scrollbar
    must appear.
  4. Run the program with a Windows Aero theme active.

What is the expected output?

  • The scrollbar should ALWAYS be visible, no matter where the
    mouse cursor is positioned.

What do you see instead?

  • By default, the scrollbar is visible (fine).
  • By moving the mouse, the scrollbar VANISHES when the mouse
    enters or leaves the scrollbar region, and slowly fades in
    again.
  • When the vertical scrollbar vanishes, the HTML text from the
    left side of the THTMLViewer is duplicated at the place where
    the scrollbar SHOULD be.

This problem does NOT appear when

  • using Windows Classic Mode,
  • the TXPManifest is thrown out or
  • the THTMLViewer is put on any parent with DoubleBuffered:=FALSE.

Which version of the product are you using?

  • HtmlViewer113-r306
    (the error also appeared in version 112-r254)
  • HtmlViewer115

Which compiler version are you using?

  • Delphi XE2, 32bit
  • Delphi XE5, 32bit

On which operating system?

  • Windows 7, 64bit

HTMLEditor demo won't compile

Declaration of type TPropDisplay is missing so it should either have UseOldStyleTypes defined or use ThtDisplayStyle and StyleTypes unit.

FindSourcePos bug (and probable solution)

I have an HTML string, I load it in an THtmlViewer component, and then I click on the viewer with the mouse and I want to find the corresponding position in the HTML source. The code to find the source position should go something like this

// X and Y are the mouse coordinates:
DP := HtmlViewer1.XYToDisplayPos(X, Y);
// DP is an integer:
SP := HtmlViewer1.FindSourcePos(DP);

...and now SP should contain the index of the position in the source code.

However, when I look for the text in HtmlViewer1.DocumentSource near position SP, it's clearly the wrong place.

Then, after a lot of head scratching, I found that the correct position is SP div 2. If I divide the result of FindSourcePos by two, that is the correct result.

If this is a bug, it guess that it has something to do with the AnsiString vs. WideString format of the HTML source.

Hopefully this will be helpful to someone... cheers :)

Installing on Delphi XE

Whats with the DCC Fatal Error when installing on Delphi XE throung (FrameViewerXE.dpk)
[DCC Fatal Error] GDIPL2A.pas(124): F1026 File not found: 'GDIPUTIL.dcu'

CSS 2.1

A have problem with CSS styles . I don't know how to :hover TR in TABLE , parsing is ok but it dosent work .

Property "display" vs. HtmlViewer object model

As property "display" can switch an inline element to a block element and vice versa, the HtmlViewer's object structure, which divides the elements into TSection a block of text incl. inlined images and other TBlocks is obsolete.

In a revised object structure there should be no hard coded "display" property in the element objects. All objects should be able to be rendered with "display=inline", "display=block", ...

Embedded Forms/Frames?

It is theoretically possible to embedd VCL-forms or -frames in HTML-code?

my idea is, to implement a tag like , which fire a event OnLoadEmbeddedForm. This Event returns the form-handle. The html-component show the form.

ac0777a006d10fdbc922a4412a374d151e5c1184 breaks JPG with TRANSP attribute

If NoGDIPlus is $defined, ac0777a makes JPG images transparent as if the TRANSP attribute was present.

In trying to fix this, I discovered a number of improvement possibilities in function LoadImageFromStream(). I have hence refactored the function slightly to

  • do not apply LLCorner transparency to JPG.
  • Ensure that icon files always have LLCorner transparency, even if loaded via GDIPlus.
  • turn Load... functions into procedures where no result value is needed.
  • use single case instead of multiple if statements.
  • only use KindOfImage() for image check and avoid Stream.Size, which is an expensive operation with little value.
  • Avoid FreeAndNil() where the nil is not needed.

For testing, I have developed a collection of image files with HTML. Unfortunately GitHub does not allow attachments to issues. Please e-mail me so I can send you a copy.

Here is the code. Feel free to substitute:

function LoadImageFromStream(Stream: TStream; Transparent: TTransparency{; var AMask: TBitmap}): ThtImage;
// extracted from ThtDocument.GetTheBitmap(), ThtDocument.InsertImage(), and ThtDocument.ReplaceImage()

{$ifndef NoMetafile}
  function LoadMetafileImage: ThtImage;
  var
    Meta: ThtMetaFile;
  begin
    Meta := ThtMetafile.Create;
    try
      Meta.LoadFromStream(Stream);
    except
      Meta.Free;
      raise;
    end;
    Result := ThtMetafileImage.Create(Meta);
  end;
{$endif NoMetafile}

{$ifndef NoGDIPlus}
  function LoadGpImage: ThtImage;
  var
    Image: ThtGpImage;
  begin
    Result := nil;
    if GDIPlusActive then
    begin
      Image := ThtGpImage.Create(Stream);
      try
        Result := ThtGdipImage.Create(Image);
      except
        Image.Free;
        raise;
      end;
    end;
  end;
{$endif !NoGDIPlus}

var
  Bitmap, Mask: TBitmap;

  function LoadGif: ThtImage;
  var
    Gif: TGifImage;
    NonAnimated: Boolean;
  begin
    Gif := LoadGifFromStream(NonAnimated, Stream);
    if NonAnimated then
    begin {else already have animated GIF}
      try
        Bitmap := TBitmap.Create;
        Bitmap.Assign(Gif.MaskedBitmap);
        if Gif.IsTransparent then
        begin
          Mask := TBitmap.Create;
          Mask.Assign(Gif.Mask);
          Transparent := TrGif;
        end;
      finally
        Gif.Free;
      end;
      Result := nil;
    end
    else
      Result := ThtGifImage.Create(Gif);
  end;

  procedure LoadPng;
{$ifdef LCL}
  var
    pngImage: TPortableNetworkGraphic;
  begin
    pngImage := TPortableNetworkGraphic.Create;
    try
      pngImage.LoadFromStream(Stream);
      if ColorBits <= 8 then
        pngImage.PixelFormat := pf8bit
      else
        pngImage.PixelFormat := pf24bit;
      Bitmap := TBitmap.Create;
      Bitmap.Assign(pngImage);
      pngImage.Mask(clDefault);
      if pngImage.MaskHandleAllocated then
      begin
        Mask := TBitmap.Create;
        Mask.LoadFromBitmapHandles(pngImage.MaskHandle, 0);
        Transparent := TrPng;
      end;
    finally
      pngImage.Free;
    end;
{$else}
  begin
{$endif}
  end;

  procedure LoadJpeg;
  var
    jpImage: TJpegImage;
  begin
    jpImage := TJpegImage.Create;
    try
      jpImage.LoadFromStream(Stream);
      if ColorBits <= 8 then
      begin
        jpImage.PixelFormat := {$ifdef LCL} pf8bit {$else} jf8bit {$endif};
        if not jpImage.GrayScale and (ColorBits = 8) then
          jpImage.Palette := CopyPalette(ThePalette);
      end
      else
        jpImage.PixelFormat := {$ifdef LCL} pf24bit {$else} jf24bit {$endif};
      Bitmap := TBitmap.Create;
      Bitmap.Assign(jpImage);
      Transparent := NotTransp;
    finally
      jpImage.Free;
    end;
  end;

  procedure LoadIco;
  var
    Icon: TIcon;
  begin
    Icon := TIcon.Create;
    try
      Icon.LoadFromStream(Stream);
      Bitmap := TBitmap.Create;
      Bitmap.Assign(Icon);
      Transparent := LLCorner;
    finally
      Icon.Free;
    end;
  end;

  procedure LoadBmp;
  begin
    Bitmap := TBitmap.Create;
    Bitmap.LoadFromStream(Stream);
  end;

var
  ImageFormat: ThtImageFormat;
begin
  Result := nil;

  Stream.Position := 0;
  ImageFormat := KindOfImage(Stream);
  if ImageFormat = itNone then
    Exit;

  Mask := nil;
  Bitmap := nil;
  try

{$ifndef NoGDIPlus}
    if not (ImageFormat in [itBmp, itIco, itGif]) then
      try
        Result := LoadGpImage;
      except
        // just continue without image...
      end;
{$endif !NoGDIPlus}

    if Result = nil then
      case ImageFormat of
        itIco,
        itCur: LoadIco;
        itGif: Result := LoadGif;
        itPng: LoadPng;
        itJpg: LoadJpeg;
        itBmp: LoadBmp;
      end;

    if (Result = nil) and (Bitmap <> nil) then
      begin
        if Transparent = LLCorner then
          Mask := GetImageMask(Bitmap, False, 0);
        Bitmap := ConvertImage(Bitmap);
        Result := ThtBitmapImage.Create(Bitmap, Mask, Transparent);
      end;
  except
    Bitmap.Free;
    Mask.Free;
    FreeAndNil(Result);
  end;

{$IFNDEF NoMetafile}
  if Result = nil then
    try
      Result := LoadMetafileImage;
    except
      // just continue without image...
    end;
{$ENDIF}
end;

Multiple pseudo elements can apply

I was testing THTMLViewer 11 with links and I found some incorrect behavior. If a color is not specified by a pseudo-class CSS element, the color reverts back to the THTMLViewer default color. This is incorrect if there is more than one pseudo-class involved with the element.

In the following HTML, I would expect the font-color for either the ":link" or ":visited" to appear instead of the default active link color. The only difference that should appear is that if you move the cursor over the link, the underline disappears and a 2-pixel dotted border should appear. A number of websites do this with CSS, mine included.

<title></title> <style type="text/css"> a:link { color: #800000; } a:visited { color: #4C0000; } a:active { color: #990000; } a:hover { border: 2px dotted; text-decoration: none; } </style>

Click the link to go to http://www.jpetermugaas.com/.

#

XE8 Package

When will there be a delphi Xe8 package ?

Is this project for Windows only?

Is this project for Windows only?

My compilation is stopping on InitFlatSB which makes a call to handle:=GetModuleHandle('comctrl32.dll');?

Missing Property AttributeValue

Hello,
I need some attributes from a form control and there was in version 9.41 the property AttributeValue in TFormControlObj, like this :
TFormControlObj(FormControlList[i]).AttributeValue['style']

Is there a way to access it ?

Thank you
Frederic

Installing Htmlviewer on Delphi XE8

I am unable to fully install Htmlviewer version 11 on my Windows 10 64-bit machine. I am able to compile the DPK file after correcting syntax errors on the content of the DPK file. Errors are

  1. Miss-spelling of Requires is supplied with two 'R' at start of the line.
  2.                      Contains                                'C'
    
  3. Final end statement appears as 'd'
    Correcting these problems and then all the DCU files appear in my DCULIB directory.
    But I am then unable to install the component, and there is no sign of the component icon and the Complib build fails. I remember there was a problem with the Delphi XE starter kit that could not register a component and make it appear in the list of installed components. Is this still a problem or is this a new version of the problem. FrameviewerReg.pas seems to have the code

Too many parsers?

There are duplicate-named classes in the sources:

THtmlParser --> in HtmlParser.pas and ReadHTML.pas

THtmlStyleParser --> StyleParser.pas and StylePars.pas

These classes, even though they share names, are distinct classes.

Is this an oversight, or are they artifacts of ongoing refactoring?

Text not respecting screen/print boundries

If a webpage has a graphic or line or table that extends to the right beyond the viewport/window boundary then all the following text also uses that new extended boundary. IE doesn't do this. In IE even if a graphic or line or table extends beyond the right margin the text above and below is wrapped to the window dimensions.
This is critical for viewing and printing emails. It is a little thing if a graphic is mis-sized beyond the margin and prints on two pages. Same with tables, not a big deal if it prints on a second page. However with HTMLViewer all following text then will wrap across two pages also. IE is more pragmatic and wraps the text to window dimensions and wraps to paper dimensions. I hacked htmlviewer and just ignored the width specification on h elements and now it automatically adjusts to window width. I am researching if I can do the same thing with graphics with a width gt 500px.

Some unicode Characters appear as square boxes

Unicode Character ⁴, ⁵, ⁶, ⁷. ⁸ ⁹ appear as square boxes. There may be others as well. I am loading from a string and the other Unicode characters from the string appear correctly.

Various suggestions

Hi,

First, of all, a big thnk you for this component, as I was looking for an HTML parser and now I found one. I just thought you might be interested in knowing how developers will use it and receive some feedback/suggestions on it.

I'm just interested in a component that can take some HTML text and render it on a canvas. Therefore, your component is much more powerful than my needs and I'm in the process of removing all the unecessary code (e.g. I need to be able to draw text with formatting, have images embedded but I don't need sounds, scripts, form controls, events). While doing this, I got to learn about the structure of your objects and would like to suggest the following:

I understand that in version 12, you are planning some in depth internal changes so this might be what you are planning already. This is my humble suggestion:
You could have 4 main core objects (and my suggestion mainly focuses here on number 2 and 3):
1- The parser: the one that takes an HTML file and fragments it into HTML tokens.
2- The renderer on a canvas: I would see this one as being the object that only handles graphical tokens (e.g. text formatting, lines, images, etc.) and it is a descendant of TObject and simply drawns on a provided canvas within a provided Rect (e.g. Procedure DrawHTML(aCanvas : TCanvas; aRect : TRect)). This can thus be used in places where a software only needs powerful drawing of formatted texts but no need for all the overheads associated with the more powerful HTML features (my case to be honest).
3- The renderer of full HTML features on a control: This is a descendant of the canvas renderer in point 2. It also handles creation of all form controls, sounds, events, etc. hance needs to render on a control (i.e. is kind of THTMLViewer but with a large part of the processing done by point number 2 moved to that component)
4- The HTMLViewer control: a control that can be placed on a form to display an HTML text.

I think this architecture would allow you to see your components used in many more applications, you might for example be aware of TMS Software for example where they have many numerous HTML renderers (ridiculous number actually). Using their components + yours could add 1 MB of exe size for codes aiming at doing the same thing. If you implemented my suggestion and manage to impose yourself as the HTML renderer standard in Delphi (as you could easily, your component is so nice), your code could be used by them and others, helping maintenance and code size.

Various other suggestions:

  • Have you considered cleaning the code so that it adheres to coding standards in terms of naming? You probably know, for example that a "T" is usually used in front of all type names. This is missing in numerous instances. It makes it very difficult for people reading you code to understand when it's not clear immediately what word corresponds to what (a type, a variable?).
  • In the same direction, it is not recommended to have variables in public section of objects, better move them to the private section and use a property:

TMyClass = Class(TMyAncestor)
Public
XXX : TXXXType;
...
End

to be replaced by:
TMyClass = Class(TMyAncestor)
Private
FXXX : TXXXType;
Public
...
Property XXX : TMyXXXType Read FXXX Write FXXX;
End

Also, it is common practice to call all private variables with an "F" prefix.

  • Please, comment your code, indicate what each method is meant for. So far, very little in that direction.

All of these contribute to users being able to concentration on code meaning rather than syntax. As you clearly are focused on open source for other to use, that would bring a big benefit to the community.

DocumentSource gives empty string

Hello,

In my program I build a html-page in a string variable and then use LoadFromString() to load it in a THtmlViewer object. Previously I've been able to use the property DocumentSource to save the created page as a textfile for debug purposes. But now I get an empty file, or perhaps two random characters.

This is the code I use to save the page:

SourceList := TStringList.Create;
try
SourceList.Text := html.DocumentSource;
SourceList.SaveToFile(ChangeFileExt(Application.ExeName, '.log'));
finally
SourceList.Free;
end;

I've been using the master branch of HtmlViewer with XE2 and XE3. Today I also tried the latest HtmlViewer 11 with same result. The latest downloaded source code I have that work is from July 21th 2012.

Do you have any idea what can be wrong ? Is there perhaps a better way to save the html source of a page ?

Best Regards

Just a question of the branches

Is the branch called HtmlViewer2 meant to be 12 instead of 2 ?

Previously I've been using the master branch for my projects and I assume it will be updated with stable changes. Or is it better to use one of the other branches ?

Best Regards

More flexible history

I suggest to add flexibility to the history system. Now it deals with local files only what seems very strange to me. I suppose it should be customizable via events to allow loading urls or even any custom stuff (currently I use THV for my help system with pseudo-urls looking like "help:Topic_Name").
I'll create pull request with quick workaround a little later.

Incomplete contextual style selectors: combinators '+', '*' and '~' are not supported

Currently the combinator characters '+' (CSS2.1) and '*', '~' (CSS3) stop parsing the selector and assign the style to the style read up to now skipping the rest of the selectors before next '{'.

In case of "body ul+li {...}" the style is assigned to "body ul", which is definitely wrong.

Now these styles are skipped until they are processed correctly, which is subject of this issue.

Redundant but not quite identical

The enumerated type named 'THtmlElementSymbol' (in 'HtmlSymbols.pas') and 'Symb' (in HTMLUn2.pas) are (or should have been) the same --i.e. one or the other is redundant.

But, when compared to 'Symb', 'THtmlElementSymbol' is missing these words.

ABBR
ACRONYM
APPLET
BDO
DEL
DFN
EMBED
H1
H2
H3
H4
H5
H6
INS
NOEMBED
NOSCRIPT
OPTGROUP
Q

And, when compared to 'THtmlElementSymbol', 'Symb' is missing these words.

ARTICLE
ASIDE
FOOTER
H
HEADER
HGROUP
MARK
NAV
SECTION

IOW, both are incomplete.

[When I say "incomplete", I don't mean to imply that I have checked them against any given HTML version. They are incomplete when compared with another --i.e. some words are missing in one, while others are missing from the other one.]

And.. did I mention that 'Symb' was a lousy choice for enumerated type :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.